| | |
| | | using Masuit.Tools.Models; |
| | | using Microsoft.AspNetCore.SignalR.Protocol; |
| | | using NewPdaSqlServer.DB; |
| | | using NewPdaSqlServer.Dto.service; |
| | | using NewPdaSqlServer.entity; |
| | |
| | | if (string.IsNullOrEmpty(entity.userName)) throw new ArgumentNullException(nameof(entity.userName), "用户名不允许为空"); |
| | | if (string.IsNullOrEmpty(entity.sectionCode)) throw new ArgumentNullException(nameof(entity.sectionCode), "库位编号不允许为空"); |
| | | if (string.IsNullOrEmpty(entity.barcode)) throw new ArgumentNullException(nameof(entity.barcode), "条码不允许为空"); |
| | | |
| | | |
| | | using (var conn = new SqlConnection(connectionString)) |
| | | { |
| | | using (var cmd = new SqlCommand("[prc_pda_inv_cgrk]", conn)) |
| | |
| | | string? outMessage = parameters[4].Value?.ToString(); |
| | | string? outSum = parameters[5].Value?.ToString(); |
| | | |
| | | |
| | | // 检查参数是否为空,并在异常中显示实际值 |
| | | if (string.IsNullOrEmpty(outMessage) || string.IsNullOrEmpty(outSum)) |
| | | throw new InvalidOperationException("存储过程返回参数异常"); |
| | | { |
| | | // 拼接参数实际值(处理 null 的情况) |
| | | string messageValue = outMessage ?? "null"; |
| | | string sumValue = outSum ?? "null"; |
| | | throw new InvalidOperationException( |
| | | $"存储过程返回参数异常:输出消息为【{messageValue}】,输出数量为【{sumValue}】" |
| | | ); |
| | | } |
| | | |
| | | // 验证结果 |
| | | if (!int.TryParse(outSum, out int result) || result <= 0) |
| | |
| | | WHERE a.Item_In_Id = '{0}' AND a.Item_Id = '{1}'", cId, itemBarcodeDetails.ItemId); |
| | | |
| | | res.ItemBarCDetails = Db.Ado.SqlQuery<dynamic>(sql2); |
| | | //查询已入库总数 |
| | | var totalCDetailsQuantity = Db.Queryable<MesInvItemInCDetails>() |
| | | .Where(it => it.ItemInId == cId) |
| | | .Sum(it => it.Quantity); |
| | | |
| | | res.SumQuantity = Convert.ToDecimal(totalCDetailsQuantity); |
| | | |
| | | // 设置返回信息 |
| | | res.Message = outMessage; |
| | | res.SumQuantity = result; |
| | | |
| | | |
| | | return res; |
| | | } |
| | |
| | | // 将查询到的条码信息赋值给返回模型 |
| | | res.itemBarcodeDetails = itemBarcode; |
| | | |
| | | |
| | | |
| | | res.Message = "查询成功"; |
| | | |
| | | |
| | | |
| | | return res; |
| | | } |
| | |
| | | string strMsg = ""; |
| | | string intSum = ""; |
| | | string cfBar = ""; |
| | | |
| | | |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | using (var cmd = new SqlCommand("[prc_pda_bar_cf_before]", conn)) |
| | |
| | | string ytMsg = ""; |
| | | string ytSum = ""; |
| | | string ytdh = ""; |
| | | |
| | | |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | using (var cmd = new SqlCommand("prc_pda_scan_CGYT", conn)) |
| | |
| | | |
| | | cmd.Parameters.AddRange(ytParameters); |
| | | cmd.ExecuteNonQuery(); |
| | | |
| | | |
| | | ytMsg = ytParameters[2].Value.ToString(); |
| | | ytSum = ytParameters[3].Value.ToString(); |
| | | ytdh = ytParameters[4].Value.ToString(); |
| | |
| | | // 调用入库存储过程 prc_pda_inv_cgrk,使用原始条码 |
| | | string rkMsg = ""; |
| | | string rkSum = ""; |
| | | |
| | | |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | using (var cmd = new SqlCommand("prc_pda_inv_cgrk", conn)) |
| | |
| | | |
| | | cmd.Parameters.AddRange(rkParameters); |
| | | cmd.ExecuteNonQuery(); |
| | | |
| | | |
| | | rkMsg = rkParameters[3].Value.ToString(); |
| | | rkSum = rkParameters[4].Value.ToString(); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // 优化查询(去除空格并忽略大小写) |
| | | var mesInvItemInCDetails = Db.Queryable<MesInvItemInCDetails>() |
| | |
| | | |
| | | res.ItemBarCDetails = Db.Ado.SqlQuery<dynamic>(sql2, new { cId, itemId = itemBarcode.ItemId }); |
| | | |
| | | res.Message = $"验退操作成功,拆分后条码:{cfBar},验退单号:{ytdh}"; |
| | | res.SumQuantity = res.ItemBarCDetails?.Count ?? 0; |
| | | |
| | | //查询已入库总数 |
| | | var totalCDetailsQuantity = Db.Queryable<MesInvItemInCDetails>() |
| | | .Where(it => it.ItemInId == cId) |
| | | .Sum(it => it.Quantity); |
| | | |
| | | res.SumQuantity = Convert.ToDecimal(totalCDetailsQuantity); |
| | | |
| | | |
| | | res.Message = $"验退操作成功,拆分后条码:{cfBar},验退单号:{ytdh}"; |
| | | // res.SumQuantity = res.ItemBarCDetails?.Count ?? 0; |
| | | res.SumQuantity = Convert.ToDecimal(totalCDetailsQuantity); |
| | | return res; |
| | | } |
| | | catch (Exception ex) |