bug处理,二楼空载具料架入库
This commit is contained in:
@@ -553,7 +553,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从暂存仓呼叫料架到产线
|
||||
/// 通过工位查找料架信息
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
@@ -621,5 +621,77 @@ namespace Tnb.WarehouseMgr
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从产线呼叫装料架到暂存仓
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> RackInstock(MaterialTransferRackInstockInput input)
|
||||
{
|
||||
try
|
||||
{
|
||||
BasLocation startlocation = _db.Queryable<BasLocation>().Where(r => r.id == input.startlocation_id).First();
|
||||
if (startlocation == null)
|
||||
{
|
||||
Logger.LogWarning($"【RackEmptyInstock】不存在id为{input.startlocation_id}的库位!");
|
||||
throw new AppFriendlyException($"【RackEmptyInstock】不存在id为{input.startlocation_id}的库位!", 500);
|
||||
}
|
||||
if (string.IsNullOrEmpty(input.carry_code))
|
||||
{
|
||||
Logger.LogWarning($"【RackEmptyInstock】料架不能为空!{input.carry_code}");
|
||||
throw new AppFriendlyException($"【RackEmptyInstock】料架不能为空!{input.carry_code}!", 500);
|
||||
}
|
||||
if (input.judgeEmptyCarry)
|
||||
{
|
||||
List<WmsCarryCode> wmsCarryCodes = _db.Queryable<WmsCarryH>()
|
||||
.InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id)
|
||||
.Where((a, b) => input.details.Select(r => r.carry_code).Contains(a.carry_code)).Select((a, b) => b).ToList();
|
||||
if (wmsCarryCodes.Count > 0)
|
||||
{
|
||||
Logger.LogWarning($"【RackEmptyInstock】存在非空料箱{string.Join(',', wmsCarryCodes.Select(r => r.carry_code).Distinct())},不能入库!{input.carry_code}");
|
||||
throw new AppFriendlyException($"【RackEmptyInstock】存在非空料箱{string.Join(',', wmsCarryCodes.Select(r => r.carry_code).Distinct())},不能入库!{input.carry_code}!", 500);
|
||||
}
|
||||
}
|
||||
|
||||
// 找到未占用且未锁定的库位
|
||||
ISugarQueryable<BasLocation> rackEndLocations =
|
||||
_db.Queryable<BasLocation>()
|
||||
.Where(r => r.wh_id == "33780009364245" && r.is_use == "0" && r.is_lock == 0).OrderBy(a => a.id).Take(1);
|
||||
|
||||
if (rackEndLocations.Count() == 0)
|
||||
{
|
||||
Logger.LogWarning($"【RackEmptyInstock】没有可用的终点库位");
|
||||
throw new AppFriendlyException($"【RackEmptyInstock】没有可用的终点库位!", 500);
|
||||
}
|
||||
|
||||
BasLocation endlocation = rackEndLocations.First();
|
||||
|
||||
|
||||
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
|
||||
commonCreatePretaskInput.startlocation_id = startlocation.id;
|
||||
commonCreatePretaskInput.endlocation_id = endlocation.id;
|
||||
commonCreatePretaskInput.carry_code = input.carry_code;
|
||||
commonCreatePretaskInput.task_type = "";
|
||||
commonCreatePretaskInput.biz_type = "FloorCallMaterial";
|
||||
|
||||
var res = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput);
|
||||
if (res.code != JNPF.Common.Enums.HttpStatusCode.OK)
|
||||
{
|
||||
Logger.LogInformation($"【RackEmptyInstock】生成预任务失败 载具 {input.carry_code}");
|
||||
throw new AppFriendlyException($"生成预任务失败 载具 {input.carry_code}", 500);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("【RackEmptyInstock】" + ex.Message);
|
||||
Logger.LogError("【RackEmptyInstock】" + ex.StackTrace);
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user