修改序列号

This commit is contained in:
2025-08-07 15:58:11 +08:00
parent 832335e6f5
commit ce707d726f
2 changed files with 44 additions and 14 deletions

View File

@@ -476,16 +476,17 @@ namespace BarCode.Web.Domain.Services
public async Task<Result> TransferSn(TransferSNOneTwoTwoRequest dto)
{
_logger.LogInformation($"获取到dto:{JsonConvert.SerializeObject(dto)}");
string strMes = "";
// _logger.LogInformation($"获取到dto:{JsonConvert.SerializeObject(dto)}");
//先判断是否有存在使用的序列号,如果有的话,就报错。
dto.ids = dto.ids.Distinct().ToList();
_logger.LogInformation($"获取到dto.ids:{JsonConvert.SerializeObject(dto.ids)}");
// _logger.LogInformation($"获取到dto.ids:{JsonConvert.SerializeObject(dto.ids)}");
var sAll = dto.ids.Select(s => s.Id).ToList();
_logger.LogInformation($"获取到sAll:{JsonConvert.SerializeObject(sAll)}");
// _logger.LogInformation($"获取到sAll:{JsonConvert.SerializeObject(sAll)}");
List<SerialNumbers> isUselist = await _serialNumbersRepositories.GetUseEntityListByGRIds(sAll);
_logger.LogInformation($"获取到isUselist:{JsonConvert.SerializeObject(isUselist)}");
// _logger.LogInformation($"获取到isUselist:{JsonConvert.SerializeObject(isUselist)}");
if (isUselist.Count>0)
{
@@ -495,37 +496,37 @@ namespace BarCode.Web.Domain.Services
string spec = "";
GenerateRecordIdAll.Distinct();
_logger.LogInformation($"获取到GenerateRecordIdAll:{JsonConvert.SerializeObject(GenerateRecordIdAll)}");
// _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)}");
// _logger.LogInformation($"获取到y:{JsonConvert.SerializeObject(y)}");
if (spec == "")
{
spec = y[0].Specifications;
_logger.LogInformation($"获取到specA:{y[0].Specifications}");
// _logger.LogInformation($"获取到specA:{y[0].Specifications}");
}
else
{
spec = spec + "," + y[0].Specifications;
_logger.LogInformation($"获取到spec:{spec}");
// _logger.LogInformation($"获取到spec:{spec}");
}
}
strMes = spec;// + " 序列码存在已使用, 请选择未使用序列码的数据 ";
ValueTuple<int, string> IsUseError = (70003, spec + " 序列码存在已使用, 请选择未使用序列码的数据 ");
return Result.ReFailure(IsUseError);
// ValueTuple<int, string> IsUseError = (70003, spec + " 序列码存在已使用, 请选择未使用序列码的数据 ");
// return Result.ReFailure(IsUseError);
}
//取出所有的生成记录
string specNum = "";
var generateRecords = await _sGenerateRecordRepositories.GetEntityList(sAll, "0");
for (int i = 0; i < generateRecords.Count; i++)
{
@@ -534,8 +535,37 @@ namespace BarCode.Web.Domain.Services
if (result != 0)//
{
return Result.ReFailure(ResultCodes.IsTwoError);
//说明这条记录是单数
var y = dto.ids.Where(x => x.Id == generateRecords[i].Id).ToList();
if (specNum == "")
{
specNum = y[0].Specifications;
// _logger.LogInformation($"获取到specA:{y[0].Specifications}");
}
else
{
specNum = specNum + "," + y[0].Specifications;
// _logger.LogInformation($"获取到spec:{spec}");
}
//return Result.ReFailure(ResultCodes.IsTwoError);
}
}
if (strMes != "" && specNum != "")
{
ValueTuple<int, string> IsUseError = (70003, specNum + " 两件装产品,数量需填双数 " + strMes + " 序列码存在已使用, 请选择未使用序列码的数据 ");
return Result.ReFailure(IsUseError);
}
else if (specNum != "")
{
ValueTuple<int, string> strMesError = (70005, specNum + " 两件装产品,数量需填双数!");
return Result.ReFailure(strMesError);
}
else if (strMes != "")
{
ValueTuple<int, string> strMesError = (70004, strMes + " 序列码存在已使用, 请选择未使用序列码的数据 ");
return Result.ReFailure(strMesError);
}

View File

@@ -24,7 +24,7 @@ namespace BarCode.Web.Domain.Values
public static ValueTuple<int, string> NoDateError = (40005, "数据不存在");
public static ValueTuple<int, string> NoOrgError = (40006, "组织信息不存在");
public static ValueTuple<int, string> IsTwoError = (70001, "两件装产品,数量需填双数");
public static ValueTuple<int, string> IsZeroError = (70002, "数量不能为0");
public static ValueTuple<int, string> IsZeroError = (70002, "两件装产品,数量需填双数");
public static ValueTuple<int, string> IsUseError = (70003, "序列码存在已使用, 请选择未使用序列码的数据 ");
/// <summary>
/// 没有菜单权限,无法登录