kyy
2025-09-15 90ba60a8243c0b8b54f8868cbc8809343704ff46
service/Warehouse/MesXkyShdManager.cs
@@ -159,6 +159,56 @@
            }
        }
    }
    public string ConfirmSignReceipt(dynamic unity)
    {
        var _strMsg = "";
        var _intSum = 0;
        using (var conn = new SqlConnection(DbHelperSQL.strConn))
        {
            if (unity == null) throw new ArgumentNullException(nameof(unity), "参数对象不能为 null");
            if (string.IsNullOrEmpty(unity.userName?.ToString()))
                throw new ArgumentException("用户账户不允许为空", nameof(unity.userName));
            if (string.IsNullOrEmpty(unity.shdh?.ToString()))
                throw new ArgumentException("送货单号不允许为空", nameof(unity.shdh));
            using (var cmd = new SqlCommand("[prc_pda_inv_dhdsh_qs]", conn))
            {
                try
                {
                    conn.Open();
                    cmd.CommandType = CommandType.StoredProcedure;
                    SqlParameter[] parameters =
                    {
                        new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output },
                        new("@po_outSum", SqlDbType.Int) { Direction = ParameterDirection.Output },
                        new("@pi_user", SqlDbType.NVarChar) { Value = unity.userName.ToString() },
                        new("@pi_shdh", SqlDbType.NVarChar) { Value = unity.shdh.ToString() }
                    };
                    foreach (var parameter in parameters)
                        cmd.Parameters.Add(parameter);
                    cmd.ExecuteNonQuery();
                    _strMsg = parameters[0].Value.ToString();
                    _intSum = Convert.ToInt32(parameters[1].Value);
                    if (_intSum <= 0) throw new Exception(_strMsg);
                    return _strMsg;
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
                finally
                {
                    conn.Close();
                }
            }
        }
    }
}