天益四厂四楼不合格品移库
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Org.BouncyCastle.Bcpg.OpenPgp;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
{
|
||||
/// <summary>
|
||||
/// 不合格品移库
|
||||
/// </summary>
|
||||
public class UnqualifyTransferInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 载具编号
|
||||
/// </summary>
|
||||
public string carry_code { get; set; }
|
||||
/// <summary>
|
||||
/// 终点库位
|
||||
/// </summary>
|
||||
public string end_location_code { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
@@ -16,6 +17,7 @@ using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
namespace Tnb.WarehouseMgr
|
||||
@@ -182,6 +184,53 @@ namespace Tnb.WarehouseMgr
|
||||
throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 转移不合格品(api/wms/wms-pda-transfer/transfer-unqualify)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> TransferUnqualify(UnqualifyTransferInput input)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(input.carry_code))
|
||||
throw Oops.Bah("载具编号不能为空");
|
||||
if (string.IsNullOrEmpty(input.end_location_code))
|
||||
throw Oops.Bah("终点库位不能为空");
|
||||
|
||||
var wmsCarryH = await _db.Queryable<WmsCarryH>().Where(r => r.carry_code == input.carry_code).FirstAsync();
|
||||
if (wmsCarryH == null)
|
||||
throw Oops.Bah($"不存在编号为{input.carry_code}的载具");
|
||||
var endLocation = await _db.Queryable<BasLocation>().Where(r => r.location_code == input.end_location_code).FirstAsync();
|
||||
if (endLocation == null)
|
||||
throw Oops.Bah($"不存在编号为{input.end_location_code}的库位");
|
||||
if (endLocation.is_lock == 1)
|
||||
throw Oops.Bah($"库位编号{input.end_location_code}已被锁定,无法入库");
|
||||
if (string.IsNullOrEmpty(wmsCarryH.location_id))
|
||||
throw Oops.Bah($"载具编号{input.carry_code}未绑定库位");
|
||||
var startLocation=await _db.Queryable<BasLocation>().Where(r=>r.id==wmsCarryH.location_id).FirstAsync();
|
||||
if (startLocation == null)
|
||||
throw Oops.Bah($"载具编号{input.carry_code}绑定的库位未找到");
|
||||
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
//先解锁起点库位,再锁定终点库位,载具重新绑定终点库位
|
||||
|
||||
await _db.Updateable<BasLocation>().SetColumns(r => r.is_lock == 0).Where(r => r.id == startLocation.id).ExecuteCommandAsync();
|
||||
await _db.Updateable<BasLocation>().SetColumns(r => r.is_lock == 1).Where(r => r.id == endLocation.id).ExecuteCommandAsync();
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(r => r.location_id == endLocation.id).SetColumns(r => r.location_code == endLocation.location_code).Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync();
|
||||
|
||||
//生成转库单给bip
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user