68 lines
2.9 KiB
C#
Executable File
68 lines
2.9 KiB
C#
Executable File
using Microsoft.Extensions.DependencyInjection;
|
|
using Opsoft.NetCore.O3App.Domain;
|
|
using Opsoft.NetCore.O3App.Domain.Interface;
|
|
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IRepositories;
|
|
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.IServices;
|
|
using Opsoft.NetCore.O3App.Domain.UnitOfWork.WMS.Model;
|
|
using Opsoft.NetCore.O3App.Shared;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Opsoft.Data;
|
|
|
|
namespace Opsoft.NetCore.O3App.Services.WMS
|
|
{
|
|
[MapTo(typeof(IProductBarcodeCheckService), ServiceLifetime.Transient)]
|
|
public class ProductBarcodeCheckService : ServiceBase<BaseEntity, IProductBarcodeCheckRepository>, IProductBarcodeCheckService
|
|
{
|
|
private readonly IProductBarcodeCheckRepository productBarcodeCheckRepository;
|
|
public ProductBarcodeCheckService(IProductBarcodeCheckRepository repository) : base(repository)
|
|
{
|
|
Init(repository);
|
|
productBarcodeCheckRepository = repository;
|
|
}
|
|
|
|
public async Task<bool> SubmitSave(List<ProductBarcodeCheckRequest> input)
|
|
{
|
|
Dictionary<string, string> sqls = new Dictionary<string, string>();
|
|
DateTime now = DateTime.Now;
|
|
foreach (var barcodeGroup in input)
|
|
{
|
|
sqls.Add($"{barcodeGroup.Inner}/{barcodeGroup.Middle}/{barcodeGroup.Outer}",
|
|
$@" INSERT INTO T_PRD_BARCODECHECK
|
|
(
|
|
UID,
|
|
FINTERID,
|
|
FBILLNO,
|
|
FBARCODEINNER,
|
|
FBARCODEMIDDLE,
|
|
FBARCODEOUTER,
|
|
C_YMD,
|
|
C_USER,
|
|
FSTATUS,
|
|
FDELETED
|
|
) VALUES (
|
|
'{Guid.NewGuid().ToStringEx()}',
|
|
'{Guid.NewGuid().ToStringEx()}',
|
|
'{Guid.NewGuid().ToStringEx()}',
|
|
'{barcodeGroup.Inner}',
|
|
'{barcodeGroup.Middle}',
|
|
'{barcodeGroup.Outer}',
|
|
'{now.ToShortDateString()}',
|
|
'{LoginInfo.UserID}',
|
|
40,
|
|
0
|
|
); ");
|
|
}
|
|
|
|
List<string> errorBarcode = await productBarcodeCheckRepository.ExecuteAsync(sqls);
|
|
if (errorBarcode.Count > 0)
|
|
{
|
|
throw new O3AppException($"数据【{string.Join("】,【", errorBarcode)}】保存失败。");
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
}
|