啊鑫
2025-09-09 f2b71fe1d3c2b7651d525a5b5bbe66fad602ea06
WebApi/Gs.Ww/WWTBlDJManager.cs
@@ -1,16 +1,16 @@
using Gs.Toolbox.ApiCore.Common.Mvc;
using Gs.Toolbox;
using System.Data;
using System.Data;
using System.Data.SqlClient;
using System.Dynamic;
using Gs.Toolbox;
using Gs.Toolbox.ApiCore.Abstract.Mvc;
using Gs.Toolbox.ApiCore.Common.Mvc;
using Gs.Toolbox.ApiCore.Group;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using static Gs.Toolbox.UtilityHelper;
namespace Gs.Ww
{
namespace Gs.Ww;
    [ApiGroup(ApiGroupNames.WW)]
    public class WWTBlDJManager : IRomteService
    {
@@ -59,7 +59,8 @@
            };
            try
            {
                dset = DbHelperSQL.RunProcedure("prc_ww_tbldj_lst", parameters, "0");
            dset = DbHelperSQL.RunProcedure("prc_ww_tbldj_lst", parameters,
                "0");
                if (dset != null && dset.Tables.Count > 0 &&
                    dset.Tables[0].Rows.Count > 0) //有数据
                {
@@ -109,7 +110,8 @@
            var dset = new DataSet();
            try
            {
                dset = DbHelperSQL.RunProcedure("[prc_ww_tbldj_mx]", parameters, "0");
            dset = DbHelperSQL.RunProcedure("[prc_ww_tbldj_mx]", parameters,
                "0");
                if (dset != null && dset.Tables.Count > 0 &&
                    dset.Tables[0].Rows.Count > 0)
                {
@@ -133,7 +135,6 @@
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="mode"></param>
        /// <returns></returns>
@@ -147,10 +148,9 @@
            m.outMsg = "";
            // 当审核时(_inFieldValue为"1"时)检查仓库
            if (_inFieldValue == "1")
            {
                try
                {
                    string warehouseCheckSql = @"
                var warehouseCheckSql = @"
                        SELECT COUNT(1) 
                        FROM MES_INV_ITEM_IN_C_DETAILS b 
                        LEFT JOIN MES_INV_ITEM_INS h ON h.GUID = b.ITEM_IN_ID    
@@ -162,17 +162,21 @@
                        WHERE b.item_in_id = @inFieldValue
                        AND (d.WAREHOUSE IS NULL OR d.WAREHOUSE = '' OR d.WAREHOUSE = '0')";
                    var parameters = new[] {
                var parameters = new[]
                {
                        new SqlParameter("@inFieldValue", _guid)
                    };
                    var emptyWarehouseCount = DbHelperSQL.GetSingle(warehouseCheckSql, parameters);
                var emptyWarehouseCount =
                    DbHelperSQL.GetSingle(warehouseCheckSql, parameters);
                    if (emptyWarehouseCount != null && Convert.ToInt32(emptyWarehouseCount) > 0)
                if (emptyWarehouseCount != null &&
                    Convert.ToInt32(emptyWarehouseCount) > 0)
                    {
                        m.outSum = -1;
                        m.outMsg = "对应的委外单的仓库为空,无法审核!";
                        return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Exception, m.outMsg);
                    return ReturnDto<dynamic>.QuickReturn(m,
                        ReturnCode.Exception, m.outMsg);
                    }
                }
                catch (Exception ex)
@@ -180,9 +184,10 @@
                    LogHelper.Debug(ToString(), "仓库检查失败:" + ex.Message);
                    m.outSum = -1;
                    m.outMsg = "仓库检查失败:" + ex.Message;
                    return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Exception, m.outMsg);
                return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Exception,
                    m.outMsg);
                }
            }
            using (var conn = new SqlConnection(DbHelperSQL.strConn))
            {
                using (var cmd = new SqlCommand("prc_ww_tbldj_Submit", conn))
@@ -222,7 +227,7 @@
                    }
                }
            }
            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "操作成功!");
        }
    }
}