米其林项目Giraf的新接口,采用WebAPI形式,会应用在上海玉兰,印度米其林及波兰米其林项目中
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
using Serilog;
|
|
|
|
using WMS_GIRAF_Interface.Data;
|
|
|
|
using WMS_GIRAF_Interface.Entities;
|
|
|
|
using WMS_GIRAF_Interface.Repositories.Interface;
|
|
|
|
|
|
|
|
namespace WMS_GIRAF_Interface.Repositories.Implement;
|
|
|
|
|
|
|
|
public class IoControlRepository(MichelinDbContext context, ILogger<IoControlRepository> logger):IIoControlRepository
|
|
|
|
|
|
|
|
{
|
|
|
|
//获取Io Control 表数据
|
|
|
|
/// <summary>
|
|
|
|
/// 获取io control数据
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="manageId"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public IO_CONTROL? GetIoControlTaskByManageId(int manageId)
|
|
|
|
{
|
|
|
|
|
|
|
|
var ioControlInfo = context.IoControl.FirstOrDefault(x => x.MANAGE_ID == manageId);
|
|
|
|
return ioControlInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool AddIoControlTask(IO_CONTROL? ioControl ,out int? controlId)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
controlId = 0;
|
|
|
|
|
|
|
|
if (ioControl == null)
|
|
|
|
{
|
|
|
|
throw new ArgumentNullException(nameof(ioControl));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
context.IoControl.Add(ioControl);
|
|
|
|
context.SaveChanges();
|
|
|
|
Log.Information($"Catch io control task info ({ioControl.STOCK_BARCODE});");
|
|
|
|
IO_CONTROL? checkIoControlTask = context.IoControl.FirstOrDefault(x => x.STOCK_BARCODE == ioControl.STOCK_BARCODE);
|
|
|
|
controlId = checkIoControlTask != null ? checkIoControlTask.CONTROL_ID : 0;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
if (ioControl != null) Log.Error($"插入控制数据出现问题:胎号信息:{ioControl.STOCK_BARCODE};错误信息:{e.Message}");
|
|
|
|
throw;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|