Commit 14808cb6 by 赵剑炜

修改dal层数据

parent cc60725d
......@@ -91,7 +91,7 @@ namespace APIs.Controllers
{
reqTime = DateTime.Parse(req.updateTime);
}
var typeQuery = await _equipmentSizeService.Query(p => p.updateTime >= reqTime);
var typeQuery = await _equipmentTypeService.Query(p => p.updateTime >= reqTime);
List<EquipmentTypeDto> typeDto = new List<EquipmentTypeDto>() ;
Mapper.Map(typeQuery, typeDto);
var src = new ApiResult
......@@ -232,7 +232,7 @@ namespace APIs.Controllers
/// <returns></returns>
[HttpPost]
public async Task<string> SendMQ([FromBody(EmptyBodyBehavior = EmptyBodyBehavior.Allow)] RecordsReq req)
public async Task<string> SendMQ([FromBody] RecordsReq req)
{
await RabbitMQContext.SendMessageAsynce(JsonConvert.SerializeObject(req));
......
......@@ -33,9 +33,14 @@ namespace APIs
services.AddMemoryCache();
//services.AddControllers(o =>
//{
// o.AllowEmptyInputInBodyModelBinding = true;
//});
services.AddControllers()
.AddNewtonsoftJson(options =>
{
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
});
......
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
......@@ -9,32 +10,33 @@ namespace Common.Utility.Model
public class RecordsReq
{
public DateTime useTime { get; set; }
[AllowNull]
public String userName { get; set; }
[AllowNull]
public int type { get; set; }
[AllowNull]
public String equipments { get; set; }
public List<EquipmentList> equipmentList { get; set; }
public List<CarList> carList { get; set; }
[AllowNull]
public List<EquipmentList>? equipmentList { get; set; }
[AllowNull]
public List<CarList>? carList { get; set; }
//
}
public class EquipmentList
{
public String invId { get; set; }
public String epc { get; set; }
public String equipmentName { get; set; }
public String equipmentSize { get; set; }
public int outInState { get; set; }
public int errorState { get; set; }
public String? equipmentName { get; set; }
public String? equipmentSize { get; set; }
public int? outInState { get; set; }
public int? errorState { get; set; }
}
public class CarList
{
public int carId { get; set; }
public int outInState { get; set; }
public String errorState { get; set; }
public int? outInState { get; set; }
public String? errorState { get; set; }
}
}
......@@ -29,8 +29,8 @@ namespace Repositories.Repository.Bussiness
//var invs = await context.Queryable<Inventory>().Where(x =>
//model.DetailList.Select(x => x.epc).Contains(x.epc)).ToListAsync();
context.BeginTran();
await context.Updateable(cars).ExecuteCommandAsync();//实体有多少列更新多少列
var result = await context.Updateable(inv).ExecuteCommandAsync();//实体有多少列更新多少列
await context.Updateable(cars).WhereColumns(it => new { it.no }).UpdateColumns(it => new { it.state, it.updateTime }).ExecuteCommandAsync();//实体有多少列更新多少列
var result = await context.Updateable(inv).WhereColumns(it=>new { it.epc }).UpdateColumns(it => new { it.state,it.updateTime}).ExecuteCommandAsync();//实体有多少列更新多少列
var logSum = await context.InsertNav(model)
.Include(z1=>z1.DetailList)
.ExecuteCommandAsync();
......
......@@ -34,6 +34,8 @@ namespace Services
LogSummary log = mapper.Map<LogSummary>(model);
log.updateTime = DateTime.Now;
log.createTime = DateTime.Now;
if (model.equipmentList!=null)
{
foreach (var item in model.equipmentList)
{
LogDetail logdetail = mapper.Map<LogDetail>(item);
......@@ -42,25 +44,29 @@ namespace Services
logdetail.state = item.outInState;
log.DetailList.Add(logdetail);
}
}
if (model.carList != null)
{
foreach (var item in model.carList)
{
LogDetail logdetail = new LogDetail();
logdetail.createTime = DateTime.Now;
logdetail.updateTime = DateTime.Now;
logdetail.state = item.outInState;
logdetail.carid = item.carId;
log.DetailList.Add(logdetail);
}
List<Inventory> inveqList = model.equipmentList.Select(x => new Inventory()
}
List<Inventory> inveqList = model.equipmentList?.Select(x => new Inventory()
{
updateTime = DateTime.Now,
id = x.invId,
epc=x.epc,
state = x.outInState.ToString()
}).ToList();
List<Car> invCarList = model.carList?.Select(x => new Car()
{
updateTime=DateTime.Now,
id = x.carId,
state = x.outInState.ToString()
}).ToList();
return _logSummaryRepository.AddLogs(log, inveqList, invCarList);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论