啊鑫
8 天以前 0aa54059b26e6641196e9953490dd18616e916e3
service/Warehouse/KwbgManager.cs
@@ -1,12 +1,9 @@
using System.Data;
using System.Data.SqlClient;
using Masuit.Tools;
using Masuit.Tools.Hardware;
using NewPdaSqlServer.DB;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.util;
using SqlSugar;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
namespace NewPdaSqlServer.service.Warehouse;
@@ -44,8 +41,9 @@
        try
        {
            List<dynamic>? ZsBarInfo = Db.Ado.SqlQuery<dynamic>(
                "EXEC prc_pda_kwbg_selKwInfoByBarcode @pi_barcode,@inP1,@inP2,@inP3,@inP4", parameters);
            var ZsBarInfo = Db.Ado.SqlQuery<dynamic>(
                "EXEC prc_pda_kwbg_selKwInfoByBarcode @pi_barcode,@inP1,@inP2,@inP3,@inP4",
                parameters);
            return ZsBarInfo;
        }
@@ -79,6 +77,7 @@
        // 返回查询到的物料信息对象
        return itemInfo;
    }
    /// <summary>
    /// 仓库信息表
    /// </summary>
@@ -93,7 +92,6 @@
        if (depotInfo is null) throw new Exception("该条码库存不存在仓库!");
        return depotInfo;
    }
    /// <summary>
@@ -120,9 +118,11 @@
            if (string.IsNullOrEmpty(unity.userName?.ToString()))
                throw new ArgumentException("用户名不允许为空", nameof(unity.userName));
            if (string.IsNullOrEmpty(unity.OldDepotSectionCode?.ToString()))
                throw new ArgumentException("原库位不允许为空", nameof(unity.OldDepotSectionCode));
                throw new ArgumentException("原库位不允许为空",
                    nameof(unity.OldDepotSectionCode));
            if (string.IsNullOrEmpty(unity.NewDepotSectionCode?.ToString()))
                throw new ArgumentException("新库位不允许为空", nameof(unity.NewDepotSectionCode));
                throw new ArgumentException("新库位不允许为空",
                    nameof(unity.NewDepotSectionCode));
            if (string.IsNullOrEmpty(unity.barcode?.ToString()))
                throw new ArgumentException("物料条码不允许为空", nameof(unity.barcode));
@@ -151,17 +151,23 @@
                    // 输出参数:返回新库位代码
                    new("@new_depotSectionsCode", SqlDbType.NVarChar, 300),
                    // 输入参数:操作用户
                    new SqlParameter("@c_user", unity.userName?.ToString() ?? ""),
                        new SqlParameter("@c_user",
                            unity.userName?.ToString() ?? ""),
                    // 输入参数:原条码
                    new SqlParameter("@p_barcode", unity.barcode?.ToString() ?? ""),
                        new SqlParameter("@p_barcode",
                            unity.barcode?.ToString() ?? ""),
                    // 输入参数:原库位代码
                    new("@old_depotSectionsCode", unity.OldDepotSectionCode?.ToString() ??""),
                        new("@old_depotSectionsCode",
                            unity.OldDepotSectionCode?.ToString() ?? ""),
                    // 输入参数:新库位代码
                    new("@new_depotSectionsCode_input", unity.NewDepotSectionCode?.ToString() ??""),
                        new("@new_depotSectionsCode_input",
                            unity.NewDepotSectionCode?.ToString() ?? ""),
                    // 输入参数:仓库代码
                    new("@DepotCode", unity.DepotCode) { Value = unity.DepotCode ?? "" },
                        new("@DepotCode", unity.DepotCode)
                            { Value = unity.DepotCode ?? "" },
                    // 输入参数:仓库id
                    new SqlParameter("@DepotId", (int?)unity.DepotId ?? (object)DBNull.Value)
                        new("@DepotId",
                            (int?)unity.DepotId ?? (object)DBNull.Value)
                };
                    // 设置输出参数方向
                    parameters[0].Direction = ParameterDirection.Output;
@@ -178,7 +184,8 @@
                    // 获取存储过程输出参数的值
                    _strMsg = parameters[0].Value.ToString();    // 返回信息
                    _intSum = parameters[1].Value.ToString();    // 返回数量
                    _NewDepotSectionCode = parameters[2].Value.ToString();     // 新库位代码
                    _NewDepotSectionCode =
                        parameters[2].Value.ToString(); // 新库位代码
                    // 判断变更结果,如果数量小于等于0,则表示变更失败,抛出异常并返回错误信息
                    var result = Convert.ToInt32(_intSum);
@@ -187,8 +194,8 @@
                    // 使用匿名对象而不是 dynamic? 更合适
                    var dto = new
                    {
                        barcode = unity.barcode,
                        OldDepotSectionCode = unity.OldDepotSectionCode,
                        unity.barcode,
                        unity.OldDepotSectionCode,
                        NewDepotSectionCode = _NewDepotSectionCode
                    };
@@ -214,6 +221,4 @@
    ProductionPickDto有过添加
    public int? DepotId { get; set; }    //仓库id
     */
}