kyy
2025-09-15 90ba60a8243c0b8b54f8868cbc8809343704ff46
1、送货单签收
已修改2个文件
76 ■■■■■ 文件已修改
Controllers/Warehouse/MesXkyShdController.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/Warehouse/MesXkyShdManager.cs 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Controllers/Warehouse/MesXkyShdController.cs
@@ -24,7 +24,7 @@
        {
            dynamic resultInfos = new ExpandoObject();
            resultInfos.tbBillList = m.GetShdhItems(unity);
            resultInfos.tbMesItems = m.GetShdhBar(unity);
            //resultInfos.tbMesItems = m.GetShdhBar(unity);
            return new ResponseResult
            {
                status = 0,
@@ -95,4 +95,28 @@
            return ResponseResult.ResponseError(ex);
        }
    }
    /// <summary>
    ///     确定签收
    /// </summary>
    /// <returns></returns>
    [HttpPost("OkBtn")]
    public ResponseResult OkBtn(dynamic unity)
    {
        try
        {
            dynamic resultInfos = new ExpandoObject();
            resultInfos.message = m.ConfirmSignReceipt(unity);
            return new ResponseResult
            {
                status = 0,
                message = resultInfos.message,
                data = resultInfos
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
}
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();
                }
            }
        }
    }
}