南骏 池
2025-04-14 7c67d60d2233f71547bcff90e03f9343dd4f13a2
1.产品绑定,核对送检
已修改2个文件
83 ■■■■■ 文件已修改
Controllers/Wom/WomdaaController.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/Wom/WomdaaManager.cs 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Controllers/Wom/WomdaaController.cs
@@ -399,5 +399,31 @@
        }
    }
    /// <summary>
    ///     核对送检
    /// </summary>
    /// <returns></returns>
    [HttpPost("submitInspection")]
    public ResponseResult submitInspection([FromBody] dynamic query)
    {
        try
        {
            dynamic resultInfos = new ExpandoObject();
            // 先初始化tbBillList属性
            resultInfos.tbBillList = new ExpandoObject();
            resultInfos.tbBillList = m.SubmitKbInspection(query);
            return new ResponseResult
            {
                status = 0,
                message = "OK",
                data = resultInfos
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
    #endregion
}
service/Wom/WomdaaManager.cs
@@ -532,4 +532,61 @@
            }
        }
    }
    public dynamic SubmitKbInspection(dynamic query)
    {
        if (query == null) throw new ArgumentNullException(nameof(query), "参数对象不能为 null");
        // 参数校验
        if (string.IsNullOrEmpty(query.userAccount?.ToString()))
            throw new ArgumentException("用户名不允许为空", nameof(query.userAccount));
        if (string.IsNullOrEmpty(query.KbBar?.ToString()))
            throw new ArgumentException("卡板条码不允许为空", nameof(query.KbBar));
        var _strMsg = "";
        var _status = -1;
        using (var conn = new SqlConnection(DbHelperSQL.strConn))
        {
            using (var cmd = new SqlCommand("prc_pda_KBbar_submitInspection", conn))
            {
                try
                {
                    conn.Open();
                    cmd.CommandType = CommandType.StoredProcedure;
                    SqlParameter[] parameters =
                    {
                        new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount },
                        new("@pi_kb_barcode", SqlDbType.NVarChar, 100) { Value = query.KbBar },
                        new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output },
                        new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output }
                    };
                    foreach (var parameter in parameters)
                        cmd.Parameters.Add(parameter);
                    cmd.ExecuteNonQuery();
                    _strMsg = parameters[2].Value?.ToString() ?? "";
                    _status = Convert.ToInt32(parameters[3].Value ?? -1);
                    if (_status <= 0) throw new Exception(_strMsg);
                    return new {
                        message = _strMsg,
                        status = _status,
                        kbBarcode = query.KbBar
                    };
                }
                catch (Exception ex)
                {
                    throw new Exception($"卡板送检失败:{ex.Message}");
                }
                finally
                {
                    conn.Close();
                }
            }
        }
    }
}