|
|
|
@ -30,10 +30,10 @@ using System.Text;
|
|
|
|
|
#endregion << 版 本 注 释 >>
|
|
|
|
|
namespace SlnMesnac.Repository.service.Impl
|
|
|
|
|
{
|
|
|
|
|
public class RealBarCodeTaskServiceImpl : BaseServiceImpl<RealBarCodeTask>, IRealBarCodeTaskService
|
|
|
|
|
public class MesPrdBarCodeServiceImpl : BaseServiceImpl<MesPrdBarcodeInfo>, IMesPrdBarCodeService
|
|
|
|
|
{
|
|
|
|
|
private IServiceProvider _serviceProvider;
|
|
|
|
|
public RealBarCodeTaskServiceImpl(Repository<RealBarCodeTask> rep, IServiceProvider serviceProvider) : base(rep)
|
|
|
|
|
public MesPrdBarCodeServiceImpl(Repository<MesPrdBarcodeInfo> rep, IServiceProvider serviceProvider) : base(rep)
|
|
|
|
|
{
|
|
|
|
|
_serviceProvider = serviceProvider;
|
|
|
|
|
}
|
|
|
|
@ -44,24 +44,21 @@ namespace SlnMesnac.Repository.service.Impl
|
|
|
|
|
/// <param name="task"></param>
|
|
|
|
|
/// <param name="barCodeTasks"></param>
|
|
|
|
|
/// <exception cref="InvalidOperationException"></exception>
|
|
|
|
|
public void InsertBarCodeTask(RealBarCodeTask task)
|
|
|
|
|
public void InsertBarCodeTask(MesPrdBarcodeInfo mesPrdBarcodeInfo)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (task == null)
|
|
|
|
|
if (mesPrdBarcodeInfo == null)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentNullException($"保存条码队列信息异常:参数为空");
|
|
|
|
|
}
|
|
|
|
|
var taskInfos = Query(x => x.BarCode == task.BarCode).ToList();
|
|
|
|
|
var taskInfos = Query(x => x.PrdBarcodeInfo == mesPrdBarcodeInfo.PrdBarcodeInfo).ToList();
|
|
|
|
|
|
|
|
|
|
if (taskInfos.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
Deletes(taskInfos);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Insert(task);
|
|
|
|
|
|
|
|
|
|
RefreshLocalTask();
|
|
|
|
|
Insert(mesPrdBarcodeInfo);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
@ -75,53 +72,53 @@ namespace SlnMesnac.Repository.service.Impl
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="barCode"></param>
|
|
|
|
|
/// <exception cref="InvalidOperationException"></exception>
|
|
|
|
|
public void RemoveBarCodeTask(string barCode)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(barCode))
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentNullException($"移除条码队列信息异常:参数为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var taskInfos = Query(x => x.BarCode == barCode).ToList();
|
|
|
|
|
|
|
|
|
|
Deletes(taskInfos);
|
|
|
|
|
|
|
|
|
|
RefreshLocalTask();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
throw new InvalidOperationException($"移除条码队列信息异常:{e.Message}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
//public void RemoveBarCodeTask(string barCode)
|
|
|
|
|
//{
|
|
|
|
|
// try
|
|
|
|
|
// {
|
|
|
|
|
// if (string.IsNullOrEmpty(barCode))
|
|
|
|
|
// {
|
|
|
|
|
// throw new ArgumentNullException($"移除条码队列信息异常:参数为空");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// var taskInfos = Query(x => x.BarCode == barCode).ToList();
|
|
|
|
|
|
|
|
|
|
// Deletes(taskInfos);
|
|
|
|
|
|
|
|
|
|
// RefreshLocalTask();
|
|
|
|
|
// }
|
|
|
|
|
// catch (Exception e)
|
|
|
|
|
// {
|
|
|
|
|
// throw new InvalidOperationException($"移除条码队列信息异常:{e.Message}");
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
///// <summary>
|
|
|
|
|
/// 刷新条码队列缓存信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="palletTasks"></param>
|
|
|
|
|
/// <exception cref="InvalidOperationException"></exception>
|
|
|
|
|
private void RefreshLocalTask()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//private void RefreshLocalTask()
|
|
|
|
|
//{
|
|
|
|
|
// try
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
using (var scope = _serviceProvider.CreateScope())
|
|
|
|
|
{
|
|
|
|
|
var info = scope.ServiceProvider.GetRequiredService<List<RealBarCodeTask>>();
|
|
|
|
|
// using (var scope = _serviceProvider.CreateScope())
|
|
|
|
|
// {
|
|
|
|
|
// var info = scope.ServiceProvider.GetRequiredService<List<RealBarCodeTask>>();
|
|
|
|
|
|
|
|
|
|
var infos = base.Query(x => 1 == 1, y => y.RecordTime, true).ToList();
|
|
|
|
|
// var infos = base.Query(x => 1 == 1, y => y.RecordTime, true).ToList();
|
|
|
|
|
|
|
|
|
|
info.Clear();
|
|
|
|
|
// info.Clear();
|
|
|
|
|
|
|
|
|
|
info.AddRange(infos);
|
|
|
|
|
// info.AddRange(infos);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
throw new InvalidOperationException($"刷新条码队列缓存信息异常:{e.Message}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// catch (Exception e)
|
|
|
|
|
// {
|
|
|
|
|
// throw new InvalidOperationException($"刷新条码队列缓存信息异常:{e.Message}");
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
}
|