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