| | |
| | | using System.Data; |
| | | using System.Data.SqlClient; |
| | | using Masuit.Tools; |
| | | using NewPdaSqlServer.DB; |
| | | using NewPdaSqlServer.Dto.service; |
| | | using NewPdaSqlServer.entity; |
| | | using NewPdaSqlServer.util; |
| | | using SqlSugar; |
| | | using static Microsoft.EntityFrameworkCore.DbLoggerCategory; |
| | | |
| | | namespace NewPdaSqlServer.service.Warehouse; |
| | | |
| | | public class MesXkyShdManager : Repository<MesCgthSq> |
| | | { |
| | | |
| | | public dynamic GetShdhItems(dynamic unity) |
| | | { |
| | | //// 使用参数化查询防止SQL注入 |
| | |
| | | if (shdh.Count < 1) |
| | | throw new Exception($"送货单号【{unity.shdh}】不存在或未同步!"); |
| | | |
| | | // var sql3 = @"SELECT ISNULL((SELECT SUM(delivery_qty) FROM DELIVERY_NOTICE_DETAIL WHERE delivery_no = @shdh), 0) - |
| | | //ISNULL((SELECT SUM(include_qty) FROM TBL_BARCODE_INFORMATION WHERE delivery_no = @shdh), 0) AS Diffnum "; |
| | | // var sql3 = @"SELECT ISNULL((SELECT SUM(delivery_qty) FROM DELIVERY_NOTICE_DETAIL WHERE delivery_no = @shdh), 0) - |
| | | //ISNULL((SELECT SUM(include_qty) FROM TBL_BARCODE_INFORMATION WHERE delivery_no = @shdh), 0) AS Diffnum "; |
| | | |
| | | // var diffNum = Db.Ado.SqlQuery<dynamic>(sql3, sqlParams).First(); |
| | | // var diffNum = Db.Ado.SqlQuery<dynamic>(sql3, sqlParams).First(); |
| | | |
| | | // if (diffNum.Diffnum != 0) |
| | | // throw new Exception($"送货单号【{unity.shdh}】条码未全部打印或未同步,无法收货!"); |
| | | // if (diffNum.Diffnum != 0) |
| | | // throw new Exception($"送货单号【{unity.shdh}】条码未全部打印或未同步,无法收货!"); |
| | | |
| | | var sql2 = @"WITH dhmx AS( |
| | | SELECT E.line_k3id,B.paper_bill_no,B.guid,E.quantity FROM dbo.MES_INV_ITEM_ARN B LEFT JOIN MES_INV_ITEM_ARN_DETAIL E ON B.guid = E.parent_Guid |
| | |
| | | |
| | | public dynamic GetShdhBar(dynamic unity) |
| | | { |
| | | |
| | | //// 使用参数化查询防止SQL注入 |
| | | var sqlParams = new List<SugarParameter> { new("@shdh", unity.shdh) }; |
| | | |
| | |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | // 新增空对象校验 |
| | | if (unity == null) throw new ArgumentNullException(nameof(unity), "参数对象不能为 null"); |
| | | |
| | | if (unity == null) |
| | | throw new ArgumentNullException(nameof(unity), "参数对象不能为 null"); |
| | | |
| | | // 参数校验增强 |
| | | if (string.IsNullOrEmpty(unity.userName?.ToString())) |
| | | throw new ArgumentException("用户账户不允许为空", nameof(unity.userName)); |
| | | |
| | | throw new ArgumentException("用户账户不允许为空", |
| | | nameof(unity.userName)); |
| | | |
| | | if (string.IsNullOrEmpty(unity.shdh?.ToString())) |
| | | throw new ArgumentException("送货单号不允许为空", nameof(unity.shdh)); |
| | | |
| | |
| | | cmd.CommandType = CommandType.StoredProcedure; |
| | | SqlParameter[] parameters = |
| | | { |
| | | new("@po_outMsg", SqlDbType.NVarChar, 300) { Direction = ParameterDirection.Output }, |
| | | new("@po_outSum", SqlDbType.NVarChar, 300) { Direction = ParameterDirection.Output }, |
| | | new("@pi_user", SqlDbType.NVarChar) { Value = unity.userName.ToString() }, // 显式类型转换 |
| | | new("@pi_barcode", SqlDbType.NVarChar) { Value = unity.barcode.ToString() }, |
| | | new("@pi_shdh", SqlDbType.NVarChar) { Value = unity.shdh.ToString() } |
| | | new("@po_outMsg", SqlDbType.NVarChar, 300) |
| | | { Direction = ParameterDirection.Output }, |
| | | new("@po_outSum", SqlDbType.NVarChar, 300) |
| | | { Direction = ParameterDirection.Output }, |
| | | new("@pi_user", SqlDbType.NVarChar) |
| | | { Value = unity.userName.ToString() }, // 显式类型转换 |
| | | new("@pi_barcode", SqlDbType.NVarChar) |
| | | { Value = unity.barcode.ToString() }, |
| | | new("@pi_shdh", SqlDbType.NVarChar) |
| | | { Value = unity.shdh.ToString() } |
| | | }; |
| | | parameters[0].Direction = ParameterDirection.Output; |
| | | parameters[1].Direction = ParameterDirection.Output; |
| | |
| | | return _strMsg; |
| | | |
| | | //return 0; |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |