This commit is contained in:
2025-08-07 13:50:30 +08:00
parent 89674ae456
commit 832335e6f5

View File

@@ -23,6 +23,7 @@ using Org.BouncyCastle.Crypto;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -475,15 +476,17 @@ namespace BarCode.Web.Domain.Services
public async Task<Result> TransferSn(TransferSNOneTwoTwoRequest dto) public async Task<Result> TransferSn(TransferSNOneTwoTwoRequest dto)
{ {
_logger.LogInformation($"获取到dto:{JsonConvert.SerializeObject(dto)}");
//先判断是否有存在使用的序列号,如果有的话,就报错。 //先判断是否有存在使用的序列号,如果有的话,就报错。
dto.ids = dto.ids.Distinct().ToList(); dto.ids = dto.ids.Distinct().ToList();
_logger.LogInformation($"获取到dto.ids:{JsonConvert.SerializeObject(dto.ids)}");
var sAll = dto.ids.Select(s => s.Id).ToList(); var sAll = dto.ids.Select(s => s.Id).ToList();
_logger.LogInformation($"获取到sAll:{JsonConvert.SerializeObject(sAll)}");
List<SerialNumbers> isUselist = await _serialNumbersRepositories.GetUseEntityListByGRIds(sAll); List<SerialNumbers> isUselist = await _serialNumbersRepositories.GetUseEntityListByGRIds(sAll);
if(isUselist.Count>0) _logger.LogInformation($"获取到isUselist:{JsonConvert.SerializeObject(isUselist)}");
if (isUselist.Count>0)
{ {
//取出所有GenerateRecordId //取出所有GenerateRecordId
@@ -491,16 +494,24 @@ namespace BarCode.Web.Domain.Services
var GenerateRecordIdAll= isUselist.Select (s=>s.GenerateRecordId).ToList(); var GenerateRecordIdAll= isUselist.Select (s=>s.GenerateRecordId).ToList();
string spec = ""; string spec = "";
GenerateRecordIdAll.Distinct(); GenerateRecordIdAll.Distinct();
_logger.LogInformation($"获取到GenerateRecordIdAll:{JsonConvert.SerializeObject(GenerateRecordIdAll)}");
foreach (int g in GenerateRecordIdAll) foreach (int g in GenerateRecordIdAll)
{ {
var y = dto.ids.Where(x => x.Id == g).ToList(); var y = dto.ids.Where(x => x.Id == g).ToList();
_logger.LogInformation($"获取到y:{JsonConvert.SerializeObject(y)}");
if (spec == "") if (spec == "")
{ {
spec = y[0].Specifications; spec = y[0].Specifications;
_logger.LogInformation($"获取到specA:{y[0].Specifications}");
} }
else else
{ {
spec = spec + "," + y[0].Specifications; spec = spec + "," + y[0].Specifications;
_logger.LogInformation($"获取到spec:{spec}");
} }
} }