Controllers/Warehouse/MesSttlController.cs
@@ -1,9 +1,10 @@
using System.Dynamic;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.service.@base;
using NewPdaSqlServer.service.Warehouse;
using NewPdaSqlServer.util;
using System.Dynamic;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
namespace NewPdaSqlServer.Controllers.Warehouse;
@@ -13,9 +14,11 @@
/// </summary>
[Route("api/[controller]")]
[ApiController]
public class MesSttlController : ControllerBase
public class MesSttlController : BaseController
{
    private readonly MesSttlManager _manager = new();
    private readonly MesPrintMangeer _mCf = new();
    #region 基础
    /***进入模版管理可以修改模版***/
@@ -178,7 +181,7 @@
        try
        {
            dynamic resultInfos = new ExpandoObject();
            resultInfos.tbBillList = _manager.GetSttlBillNo(query);
            resultInfos.tbBillList = _manager.GetSttlBillNo(query,RequestInfo);
            return new ResponseResult
            {
                status = 0,
@@ -204,7 +207,7 @@
        try
        {
            dynamic resultInfos = new ExpandoObject();
            resultInfos.tbBillList = _manager.GetMesItemDetailByBillNo(query);
            resultInfos.tbBillList = _manager.GetMesItemDetailByBillNo(query, RequestInfo);
            if (resultInfos.tbBillList.Count < 1)
            {
@@ -262,5 +265,66 @@
        }
    }
    /// <summary>
    ///     受托退料条码拆分
    /// </summary>
    /// <param name="query">查询参数</param>
    /// <returns>拆分结果和待处理列表</returns>
    /// <remarks>
    ///     请求示例:
    ///     POST /api/MesItemBl/SplitBarcode
    ///     {
    ///     "billNo": "WO202401010001",  // 工单号(必填)
    ///     "barcode": "BC001",          // 条码号(必填)
    ///     "userName": "admin",          // 用户名(必填)
    ///     "blNo": "BL202401010001",    // 补料单号(必填)
    ///     "Num": 10                    // 拆分数量(必填,必须大于0)
    ///     }
    ///     业务处理:
    ///     - 验证补料单状态
    ///     - 验证条码库存信息
    ///     - 验证拆分数量是否合理
    ///     - 执行条码拆分事务处理
    ///     - 更新工单和补料单相关数量
    ///     返回数据包含:
    ///     - success: 拆分是否成功
    ///     - pendingList: 待处理明细列表,包含:
    ///     * Bld012: 物料ID
    ///     * Bld002: 物料编号
    ///     * Bld003: 物料名称
    ///     * Bld004: 物料规格
    ///     * Bld007: 计划数量
    ///     * Bld008: 已补数量
    /// </remarks>
    /// <response code="200">拆分成功</response>
    /// <response code="400">拆分失败,返回具体错误信息</response>
    [HttpPost("SplitBarcode")]
    public ResponseResult SplitBarcode(WarehouseQuery query)
    {
        try
        {
            dynamic resultInfos = new ExpandoObject();
            resultInfos.tbBillList = new ExpandoObject();
            resultInfos.tbBillList.printInfo = _mCf.getPrintInfo(query);
            var scanResult = _manager.SplitBarcode(query);
            resultInfos.tbBillList.cfBarInfo = _mCf.getCfInfo(scanResult);
            //dynamic resultInfos = new ExpandoObject();
            //var (success, pendingList) = _manager.SplitBarcode(query);
            //resultInfos.success = success;
            //resultInfos.pendingList = pendingList;
            return new ResponseResult
            {
                status = 0,
                message = "OK",
                data = resultInfos
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
}