序列号集合的变更-EF调整
This commit is contained in:
@@ -29,10 +29,12 @@ namespace WMS.Web.Api.Controllers
|
||||
private readonly IBoxService _boxService;
|
||||
private readonly IOutStockTaskRepositories _outStockTaskRepositories;
|
||||
private readonly IOutStockTaskService _outStockTaskService;
|
||||
public TestController(IErpService erpService, IInStockTaskService inStockTaskService,
|
||||
private readonly IBoxInventoryRepositories _boxInventoryRepositories;
|
||||
public TestController(IErpService erpService, IInStockTaskService inStockTaskService, IBoxInventoryRepositories boxInventoryRepositories,
|
||||
IBasicsRepositories transactionRepositories, IOpsService opsService, IBoxService boxService,
|
||||
IOutStockTaskRepositories outStockTaskRepositories, IOutStockTaskService outStockTaskService)
|
||||
{
|
||||
_boxInventoryRepositories = boxInventoryRepositories;
|
||||
this._erpService = erpService;
|
||||
this._inStockTaskService = inStockTaskService;
|
||||
this._transactionRepositories = transactionRepositories;
|
||||
@@ -80,11 +82,46 @@ namespace WMS.Web.Api.Controllers
|
||||
[Route("tf")]
|
||||
public async Task<string> TestTF()
|
||||
{
|
||||
//var result = await this._erpService.BillQueryForOrg();
|
||||
var result = await this._erpService.BillQueryForBillType();
|
||||
if (!result.IsSuccess)
|
||||
////var result = await this._erpService.BillQueryForOrg();
|
||||
//var result = await this._erpService.BillQueryForBillType();
|
||||
//if (!result.IsSuccess)
|
||||
// return "";
|
||||
//return JsonConvert.SerializeObject(result.Data);
|
||||
|
||||
|
||||
var tttt = new List<string>() { "ABCD14200999" };
|
||||
var boxInventorys = await _boxInventoryRepositories.Get(142);
|
||||
|
||||
var data = new List<BoxInventory>();
|
||||
|
||||
//var entity = new BoxInventory();
|
||||
//entity.Id = 34;
|
||||
//entity.BoxId = 142;
|
||||
//entity.OrgCode = "101";
|
||||
//entity.StockCode = "CK003";
|
||||
//entity.SubStockId = 2949;
|
||||
|
||||
//var det = new BoxInventoryDetails();
|
||||
|
||||
//det.Id = 266;
|
||||
//det.Fid = 34;
|
||||
//det.MaterialId = 4799560;
|
||||
//det.SerialNumbers = new List<string>() { "ABCD143001", "ABCD142002" };
|
||||
//det.Qty = 2;
|
||||
//entity.Details.Add(det);
|
||||
|
||||
boxInventorys.Details.ForEach(x=>
|
||||
{
|
||||
x.SerialNumbers.RemoveAll(t => tttt.Contains(t));
|
||||
//x.SerialNumbers.AddRange(tttt);
|
||||
x.Qty = 3;
|
||||
});
|
||||
|
||||
data.Add(boxInventorys);
|
||||
var result= await _boxInventoryRepositories.UpdateRange(data);
|
||||
return "";
|
||||
return JsonConvert.SerializeObject(result.Data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto.Inventory;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
|
||||
@@ -372,7 +372,6 @@ namespace WMS.Web.Domain.Services
|
||||
}
|
||||
}
|
||||
|
||||
string g_json = JsonSerializer.Serialize(ganenrateChangeBoxs);
|
||||
//改箱保存操作
|
||||
var changeBoxSave_Result = await _changeMoveBoxService.ChangeBoxSave(ganenrateChangeBoxs, loginInfo, isTransaction);
|
||||
if (!changeBoxSave_Result.IsSuccess)
|
||||
|
||||
@@ -188,7 +188,7 @@ namespace WMS.Web.Repositories
|
||||
List<int> list = entitys.Select(s => s.Id).ToList();
|
||||
var res = await _context.BoxInventory.Include(x => x.Details).Where(f => list.Contains(f.Id)).ToListAsync();
|
||||
_mapper.Map(entitys, res);
|
||||
await _context.SaveChangesAsync();
|
||||
var tt= await _context.SaveChangesAsync();
|
||||
if (_transaction != null)
|
||||
_transaction.Commit();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Debug;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
@@ -264,7 +266,11 @@ namespace WMS.Web.Repositories.Configuration
|
||||
ent.HasKey(x => x.Id);
|
||||
ent.Property(f => f.SerialNumbers).HasConversion(
|
||||
v => JsonConvert.SerializeObject(v),
|
||||
v => JsonConvert.DeserializeObject<List<string>>(v));
|
||||
v => JsonConvert.DeserializeObject<List<string>>(v),
|
||||
new ValueComparer<List<string>>(
|
||||
(c1,c2)=>c1.SequenceEqual(c2),
|
||||
c=>c.Aggregate(0,(a,v)=>HashCode.Combine(a,v.GetHashCode())),
|
||||
c=>(List<string>)c.ToList()));
|
||||
});
|
||||
# endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user