using System.Dynamic;
|
using Microsoft.AspNetCore.Mvc;
|
using NewPdaSqlServer.Dto.service;
|
using NewPdaSqlServer.service.Warehouse;
|
using NewPdaSqlServer.util;
|
|
namespace NewPdaSqlServer.Controllers.Warehouse;
|
|
/// <summary>
|
/// 调拨出库相关接口
|
/// </summary>
|
[Route("api/[controller]")]
|
[ApiController]
|
public class TransferOutController : ControllerBase
|
{
|
private readonly TransferOutManager _manager = new();
|
|
#region 基础CRUD
|
|
/// <summary>
|
/// 获取所有调拨出库单
|
/// </summary>
|
/// <returns>调拨出库单列表</returns>
|
[HttpPost("GetList")]
|
public ResponseResult GetList()
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
resultInfos.tbBillList = _manager.GetList();
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
#endregion
|
|
#region 调拨入库业务
|
|
/// <summary>
|
/// 扫描条码进行调拨入库处理
|
/// </summary>
|
/// <param name="query">查询参数</param>
|
/// <returns>处理结果和待处理明细</returns>
|
/// <remarks>
|
/// 请求示例:
|
/// POST /api/TransferOut/ScanReceiveBarcode
|
/// {
|
/// "billNo": "DB202401010001", // 调拨单号(必填)
|
/// "userName": "admin", // 用户名(必填)
|
/// "barcode": "BC001" // 条码号(必填)
|
/// }
|
/// 业务处理:
|
/// - 验证调拨单状态
|
/// - 验证条码库存信息
|
/// - 验证仓库一致性
|
/// - 验证数量是否超出未扫数量
|
/// - 执行调拨入库事务处理
|
/// 返回数据包含:
|
/// - form: 处理结果表单
|
/// - items: 待处理明细列表
|
/// </remarks>
|
/// <response code="200">扫描成功</response>
|
/// <response code="400">扫描失败,返回具体错误信息</response>
|
[HttpPost("ScanReceiveBarcode")]
|
public ResponseResult ScanReceiveBarcode([FromBody] WarehouseQuery query)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var (form, items) = _manager.ScanReceiveBarcode(query);
|
resultInfos.form = form;
|
resultInfos.items = items;
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
#endregion
|
|
#region 调拨出库业务
|
|
/// <summary>
|
/// 获取未完成的调拨出库单号列表
|
/// </summary>
|
/// <returns>未完成的调拨出库单号列表</returns>
|
/// <remarks>
|
/// 获取申请数量(sq)不等于已扫数量(ys)的调拨出库单号列表
|
/// </remarks>
|
/// <response code="200">成功获取调拨出库单号列表</response>
|
/// <response code="400">获取失败</response>
|
[HttpPost("GetTransferOutNoList")]
|
public ResponseResult GetTransferOutNoList()
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
resultInfos.tbBillList = _manager.GetTransferOutNoList();
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
/// <summary>
|
/// 根据单据号获取待处理的调拨出库明细列表
|
/// </summary>
|
/// <param name="query">查询参数</param>
|
/// <returns>待处理的调拨出库明细列表</returns>
|
/// <remarks>
|
/// 请求示例:
|
/// POST /api/TransferOut/GetTransferOutDetailListByBillNo
|
/// {
|
/// "billNo": "DB202401010001" // 调拨单号(必填)
|
/// }
|
/// 返回未完成的明细记录(ShNum-YsNum>0),包含:
|
/// - ItemNo: 物料编号
|
/// - ItemModel: 物料规格
|
/// - ShNum: 申请数量
|
/// - YsNum: 已扫数量
|
/// </remarks>
|
/// <response code="200">成功获取调拨出库明细</response>
|
/// <response code="400">获取失败,返回具体错误信息</response>
|
[HttpPost("GetTransferOutDetailListByBillNo")]
|
public ResponseResult GetTransferOutDetailListByBillNo(
|
[FromBody] WarehouseQuery query)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
resultInfos.tbBillList =
|
_manager.GetTransferOutDetailListByBillNo(query);
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
/// <summary>
|
/// 扫描条码进行调拨出库处理
|
/// </summary>
|
/// <param name="query">查询参数</param>
|
/// <returns>处理结果和待处理明细</returns>
|
/// <remarks>
|
/// 请求示例:
|
/// POST /api/TransferOut/ScanMoveBarcode
|
/// {
|
/// "billNo": "DB202401010001", // 调拨单号(必填)
|
/// "userName": "admin", // 用户名(必填)
|
/// "barcode": "BC001" // 条码号(必填)
|
/// }
|
/// 业务处理:
|
/// - 验证调拨单状态
|
/// - 验证条码库存信息
|
/// - 验证仓库一致性
|
/// - 验证数量是否超出未扫数量
|
/// - 执行调拨出库事务处理
|
/// 返回数据包含:
|
/// - form: 处理结果表单
|
/// - items: 待处理明细列表
|
/// </remarks>
|
/// <response code="200">扫描成功</response>
|
/// <response code="400">扫描失败,返回具体错误信息</response>
|
[HttpPost("ScanMoveBarcode")]
|
public ResponseResult ScanMoveBarcode([FromBody] WarehouseQuery query)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var (form, items) = _manager.ScanMoveBarcode(query);
|
resultInfos.form = form;
|
resultInfos.items = items;
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
/// <summary>
|
/// 分割条码进行调拨出库处理
|
/// </summary>
|
/// <param name="query">查询参数</param>
|
/// <returns>处理结果和待处理明细</returns>
|
/// <remarks>
|
/// 请求示例:
|
/// POST /api/TransferOut/SplitBarcode
|
/// {
|
/// "billNo": "DB202401010001", // 调拨单号(必填)
|
/// "userName": "admin", // 用户名(必填)
|
/// "barcode": "BC001" // 条码号(必填)
|
/// "fum": "1" // 拆分数(必填)
|
/// }
|
/// 业务处理:
|
/// - 验证调拨单状态
|
/// - 验证条码库存信息
|
/// - 验证仓库一致性
|
/// - 验证数量是否超出未扫数量
|
/// - 执行分割条码的调拨出库事务处理
|
/// </remarks>
|
/// <response code="200">分割成功</response>
|
/// <response code="400">分割失败,返回具体错误信息</response>
|
[HttpPost("SplitBarcode")]
|
public ResponseResult SplitBarcode([FromBody] WarehouseQuery query)
|
{
|
try
|
{
|
dynamic resultInfos = new ExpandoObject();
|
var message = _manager.SplitBarcode(query);
|
resultInfos.tbBillList = message;
|
return new ResponseResult
|
{
|
status = 0,
|
message = "OK",
|
data = resultInfos
|
};
|
}
|
catch (Exception ex)
|
{
|
return ResponseResult.ResponseError(ex);
|
}
|
}
|
|
#endregion
|
}
|