加了验证接口
This commit is contained in:
@@ -254,6 +254,23 @@ namespace BarCode.Web.Api.Controllers
|
|||||||
return await _serialNumberService.UpdateSn(dto);
|
return await _serialNumberService.UpdateSn(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 验证所选转两件装条码的正确性
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Route("VerifSn")]
|
||||||
|
public async Task<Result> VerifSn(TransferSNOneTwoTwoRequest dto)
|
||||||
|
{
|
||||||
|
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||||
|
if (loginInfo == null || loginInfo.UserInfo == null)
|
||||||
|
return Result.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||||
|
|
||||||
|
|
||||||
|
return await _serialNumberService.VerifSn(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 转换Sn,由单件装转成两件装
|
/// 转换Sn,由单件装转成两件装
|
||||||
|
|||||||
@@ -323,6 +323,13 @@
|
|||||||
<param name="dto"></param>
|
<param name="dto"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:BarCode.Web.Api.Controllers.SerialNumberController.VerifSn(BarCode.Web.Core.Dto.SerialNumbers.TransferSNOneTwoTwoRequest)">
|
||||||
|
<summary>
|
||||||
|
验证所选转两件装条码的正确性
|
||||||
|
</summary>
|
||||||
|
<param name="dto"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:BarCode.Web.Api.Controllers.SerialNumberController.TransferSn(BarCode.Web.Core.Dto.SerialNumbers.TransferSNOneTwoTwoRequest)">
|
<member name="M:BarCode.Web.Api.Controllers.SerialNumberController.TransferSn(BarCode.Web.Core.Dto.SerialNumbers.TransferSNOneTwoTwoRequest)">
|
||||||
<summary>
|
<summary>
|
||||||
转换Sn,由单件装转成两件装
|
转换Sn,由单件装转成两件装
|
||||||
|
|||||||
@@ -1597,6 +1597,13 @@
|
|||||||
<param name="dto"></param>
|
<param name="dto"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:BarCode.Web.Domain.IService.ISerialNumberService.VerifSn(BarCode.Web.Core.Dto.SerialNumbers.TransferSNOneTwoTwoRequest)">
|
||||||
|
<summary>
|
||||||
|
验证序列码的正确性
|
||||||
|
</summary>
|
||||||
|
<param name="dto"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:BarCode.Web.Domain.IService.ISerialNumberService.Use(System.Collections.Generic.List{System.Int32})">
|
<member name="M:BarCode.Web.Domain.IService.ISerialNumberService.Use(System.Collections.Generic.List{System.Int32})">
|
||||||
<summary>
|
<summary>
|
||||||
装箱后反写使用数
|
装箱后反写使用数
|
||||||
@@ -3443,6 +3450,14 @@
|
|||||||
<returns></returns>
|
<returns></returns>
|
||||||
<exception cref="T:System.NotImplementedException"></exception>
|
<exception cref="T:System.NotImplementedException"></exception>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:BarCode.Web.Domain.Services.SerialNumberService.VerifSn(BarCode.Web.Core.Dto.SerialNumbers.TransferSNOneTwoTwoRequest)">
|
||||||
|
<summary>
|
||||||
|
验证Sn的正确性
|
||||||
|
</summary>
|
||||||
|
<param name="dto"></param>
|
||||||
|
<returns></returns>
|
||||||
|
<exception cref="T:System.NotImplementedException"></exception>
|
||||||
|
</member>
|
||||||
<member name="M:BarCode.Web.Domain.Services.SerialNumberService.TransferSn(BarCode.Web.Core.Dto.SerialNumbers.TransferSNOneTwoTwoRequest)">
|
<member name="M:BarCode.Web.Domain.Services.SerialNumberService.TransferSn(BarCode.Web.Core.Dto.SerialNumbers.TransferSNOneTwoTwoRequest)">
|
||||||
<summary>
|
<summary>
|
||||||
转换序列号(从单件装转为两件装)
|
转换序列号(从单件装转为两件装)
|
||||||
|
|||||||
@@ -47,6 +47,12 @@ namespace BarCode.Web.Domain.IService
|
|||||||
/// <param name="dto"></param>
|
/// <param name="dto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<Result> TransferSn(TransferSNOneTwoTwoRequest dto);
|
Task<Result> TransferSn(TransferSNOneTwoTwoRequest dto);
|
||||||
|
/// <summary>
|
||||||
|
/// 验证序列码的正确性
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<Result> VerifSn(TransferSNOneTwoTwoRequest dto);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 装箱后反写使用数
|
/// 装箱后反写使用数
|
||||||
|
|||||||
@@ -466,53 +466,52 @@ namespace BarCode.Web.Domain.Services
|
|||||||
return Result.ReSuccess();
|
return Result.ReSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 转换序列号(从单件装转为两件装)
|
/// 验证Sn的正确性
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dto"></param>
|
/// <param name="dto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public async Task<Result> TransferSn(TransferSNOneTwoTwoRequest dto)
|
public async Task<Result> VerifSn(TransferSNOneTwoTwoRequest dto)
|
||||||
{
|
{
|
||||||
|
|
||||||
string strMes = "";
|
string strMes = "";
|
||||||
// _logger.LogInformation($"获取到:dto:{JsonConvert.SerializeObject(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)}");
|
// _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)}");
|
// _logger.LogInformation($"获取到:sAll:{JsonConvert.SerializeObject(sAll)}");
|
||||||
|
|
||||||
List<SerialNumbers> isUselist = await _serialNumbersRepositories.GetUseEntityListByGRIds(sAll);
|
List<SerialNumbers> isUselist = await _serialNumbersRepositories.GetUseEntityListByGRIds(sAll);
|
||||||
// _logger.LogInformation($"获取到:isUselist:{JsonConvert.SerializeObject(isUselist)}");
|
// _logger.LogInformation($"获取到:isUselist:{JsonConvert.SerializeObject(isUselist)}");
|
||||||
if (isUselist.Count>0)
|
if (isUselist.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
//取出所有GenerateRecordId
|
//取出所有GenerateRecordId
|
||||||
|
|
||||||
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)}");
|
// _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)}");
|
// _logger.LogInformation($"获取到:y:{JsonConvert.SerializeObject(y)}");
|
||||||
|
|
||||||
|
|
||||||
if (spec == "")
|
if (spec == "")
|
||||||
{
|
{
|
||||||
spec = y[0].Specifications;
|
spec = y[0].Specifications;
|
||||||
// _logger.LogInformation($"获取到:specA:{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}");
|
// _logger.LogInformation($"获取到:spec:{spec}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -520,8 +519,8 @@ namespace BarCode.Web.Domain.Services
|
|||||||
strMes = spec;// + " 序列码存在已使用, 请选择未使用序列码的数据 !";
|
strMes = spec;// + " 序列码存在已使用, 请选择未使用序列码的数据 !";
|
||||||
|
|
||||||
|
|
||||||
// ValueTuple<int, string> IsUseError = (70003, spec + " 序列码存在已使用, 请选择未使用序列码的数据 !");
|
// ValueTuple<int, string> IsUseError = (70003, spec + " 序列码存在已使用, 请选择未使用序列码的数据 !");
|
||||||
// return Result.ReFailure(IsUseError);
|
// return Result.ReFailure(IsUseError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -564,10 +563,116 @@ namespace BarCode.Web.Domain.Services
|
|||||||
}
|
}
|
||||||
else if (strMes != "")
|
else if (strMes != "")
|
||||||
{
|
{
|
||||||
ValueTuple<int, string> strMesError = (70004, strMes + " 序列码存在已使用, 不支持转两件装!");
|
ValueTuple<int, string> strMesError = (70004, strMes + " 序列码存在已使用, 不支持转两件装!");
|
||||||
return Result.ReFailure(strMesError);
|
return Result.ReFailure(strMesError);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
return Result.ReSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 转换序列号(从单件装转为两件装)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public async Task<Result> TransferSn(TransferSNOneTwoTwoRequest dto)
|
||||||
|
{
|
||||||
|
|
||||||
|
// string strMes = "";
|
||||||
|
// // _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);
|
||||||
|
// // _logger.LogInformation($"获取到:isUselist:{JsonConvert.SerializeObject(isUselist)}");
|
||||||
|
// if (isUselist.Count>0)
|
||||||
|
// {
|
||||||
|
|
||||||
|
// //取出所有GenerateRecordId
|
||||||
|
|
||||||
|
// 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}");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// strMes = spec;// + " 序列码存在已使用, 请选择未使用序列码的数据 !";
|
||||||
|
|
||||||
|
|
||||||
|
// // 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++)
|
||||||
|
// {
|
||||||
|
// int intNum = generateRecords[i].Number;
|
||||||
|
// int result = intNum % 2;
|
||||||
|
|
||||||
|
// if (result != 0)//
|
||||||
|
// {
|
||||||
|
// //说明这条记录是单数
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
List<SerialNumbers> olist = new List<SerialNumbers>();
|
List<SerialNumbers> olist = new List<SerialNumbers>();
|
||||||
bool res_Rollback = false;
|
bool res_Rollback = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user