成品调拨入库改为扫码

This commit is contained in:
2024-11-06 14:24:41 +08:00
parent 43f815ee65
commit bdf0a4186a
2 changed files with 13 additions and 5 deletions

View File

@@ -22,6 +22,10 @@
/// </summary> /// </summary>
public string? startlocation_id { get; set; } public string? startlocation_id { get; set; }
/// <summary> /// <summary>
/// 起点code
/// </summary>
public string? startlocation_code { get; set; }
/// <summary>
/// 需求单据 /// 需求单据
/// </summary> /// </summary>
public string? source_id { get; set; } public string? source_id { get; set; }

View File

@@ -186,11 +186,15 @@ namespace Tnb.WarehouseMgr
{ {
throw new AppFriendlyException("成品调拨明细id不可为空", 500); throw new AppFriendlyException("成品调拨明细id不可为空", 500);
} }
if (string.IsNullOrEmpty(input.startlocation_id)) if (string.IsNullOrEmpty(input.startlocation_code))
{ {
throw new AppFriendlyException("起点不可为空", 500); throw new AppFriendlyException("起点不可为空", 500);
} }
var baseLocation = await _db.Queryable<BasLocation>().Where(r => r.location_code == input.startlocation_code).FirstAsync();
if (baseLocation == null)
throw new AppFriendlyException($"未找到编号{input.startlocation_code}的库位", 500);
WmsTransferInstockD wmsTransferInstockD = await _db.Queryable<WmsTransferInstockD>().Where(r => r.id == input.source_id).FirstAsync(); WmsTransferInstockD wmsTransferInstockD = await _db.Queryable<WmsTransferInstockD>().Where(r => r.id == input.source_id).FirstAsync();
if (wmsTransferInstockD.status == WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID) if (wmsTransferInstockD.status == WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID)
{ {
@@ -208,7 +212,7 @@ namespace Tnb.WarehouseMgr
WmsPointH sPoint = null!; WmsPointH sPoint = null!;
WmsPointH ePoint = null!; WmsPointH ePoint = null!;
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.startlocation_id); sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == baseLocation.id);
if (endLocations?.Count > 0) if (endLocations?.Count > 0)
{ {
WmsCarryH carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.carry_code == input.carry_code); WmsCarryH carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.carry_code == input.carry_code);
@@ -303,20 +307,20 @@ namespace Tnb.WarehouseMgr
if (endLocationId != null) if (endLocationId != null)
{ {
//查询库位表 //查询库位表
BasLocation location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.startlocation_id); BasLocation location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == baseLocation.id);
{ {
//载具加锁,增加库位信息 //载具加锁,增加库位信息
_ = await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH _ = await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH
{ {
carry_status = ((int)EnumCarryStatus.).ToString(), carry_status = ((int)EnumCarryStatus.).ToString(),
is_lock = 1, is_lock = 1,
location_id = input.startlocation_id, location_id = baseLocation.id,
location_code = location.location_code location_code = location.location_code
}).Where(it => it.id == wmsCarryH.id).ExecuteCommandAsync(); }).Where(it => it.id == wmsCarryH.id).ExecuteCommandAsync();
} }
//所有库位加锁 //所有库位加锁
string?[] ids = new[] { input.startlocation_id, endLocationId }; string?[] ids = new[] { baseLocation.id, endLocationId };
_ = await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync(); _ = await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync();
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().FirstAsync(it => it.id == input.material_id); BasMaterial basMaterial = await _db.Queryable<BasMaterial>().FirstAsync(it => it.id == input.material_id);