南骏 池
6 天以前 81fae3c184966eeaa3081e456b1fb2d0e25a3456
Controllers/Warehouse/TransferOutController.cs
@@ -1,6 +1,7 @@
using System.Dynamic;
using Microsoft.AspNetCore.Mvc;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.service.@base;
using NewPdaSqlServer.service.Warehouse;
using NewPdaSqlServer.util;
@@ -15,6 +16,8 @@
{
    private readonly TransferOutManager _manager = new();
    private readonly MesPrintMangeer _mCf = new();
    #region 基础CRUD
    /// <summary>
@@ -28,6 +31,57 @@
        {
            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,
@@ -115,6 +169,30 @@
        }
    }
    [HttpPost("GetTransferInDetailListByBillNo")]
    public ResponseResult GetTransferInDetailListByBillNo(
    [FromBody] WarehouseQuery query)
    {
        try
        {
            dynamic resultInfos = new ExpandoObject();
            resultInfos.tbBillList =
                _manager.GetTransferInDetailListByBillNo(query);
            return new ResponseResult
            {
                status = 0,
                message = "OK",
                data = resultInfos
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
    /// <summary>
    ///     扫描条码进行调拨出库处理
    /// </summary>
@@ -146,9 +224,62 @@
        try
        {
            dynamic resultInfos = new ExpandoObject();
            var (form, items) = _manager.ScanMoveBarcode(query);
            resultInfos.form = form;
            resultInfos.items = items;
            resultInfos.tbBillList = _manager.ScanMoveBarcode(query);
            if (resultInfos.tbBillList.result == "2")
            {
                return new ResponseResult
                {
                    status = Convert.ToInt32(resultInfos.tbBillList.result),
                    message = resultInfos.tbBillList.strMsg,
                    data = resultInfos
                };
            }
            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("ScanCodeCF")]
    public ResponseResult ScanCodeCF(WarehouseQuery query)
    {
        try
        {
            dynamic resultInfos = new ExpandoObject();
            resultInfos.tbBillList = new ExpandoObject();
            resultInfos.tbBillList.printInfo = _mCf.getPrintInfo(query);
            var scanResult = _manager.ScanCodeCF(query);
            resultInfos.tbBillList.cfBarInfo = _mCf.getCfInfo(scanResult);
            return new ResponseResult
            {
                status = 0,