Browse Source

同上

dev_DY_CC
刘云峰 10 months ago
parent
commit
e608f1a623
  1. 7
      be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/StoreHttpApiHostModule.cs
  2. 88
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/BaseDatas/SplitPackingRecController.cs
  3. 1
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/SplitPackings/SplitPackingRecAppService.cs
  4. 54
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/SplitPackings/SplitPackingRecManager.cs

7
be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/StoreHttpApiHostModule.cs

@ -1,4 +1,6 @@
using System;
using System.IO; using System.IO;
using System.Net.Http;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.AspNetCore.Server.Kestrel.Core;
@ -98,6 +100,11 @@ public class StoreHttpApiHostModule : ModuleBase<StoreHttpApiHostModule>
protected override void ConfigureHttpClientProxies() protected override void ConfigureHttpClientProxies()
{ {
ServiceConfigurationContext.Services.AddHttpClient("Label", (HttpClient client) =>
{
client.Timeout = TimeSpan.FromSeconds(180);
});
ServiceConfigurationContext.Services.AddHttpClientProxies( ServiceConfigurationContext.Services.AddHttpClientProxies(
typeof(BasedataApplicationContractsModule).Assembly, typeof(BasedataApplicationContractsModule).Assembly,
"BaseData" "BaseData"

88
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/BaseDatas/SplitPackingRecController.cs

@ -1,11 +1,13 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Json; using Volo.Abp.Json;
using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Basedata.Commons;
using Win_in.Sfs.Basedata.Domain; using Win_in.Sfs.Basedata.Domain;
namespace Win_in.Sfs.Wms.Pda.Controllers.BaseDatas; namespace Win_in.Sfs.Wms.Pda.Controllers.BaseDatas;
@ -63,4 +65,90 @@ public class SplitPackingRecController : AbpController
return await _splitPackingRecApp.GetSamePoNumberListByToPackingCode(toPackingCode).ConfigureAwait(false); return await _splitPackingRecApp.GetSamePoNumberListByToPackingCode(toPackingCode).ConfigureAwait(false);
} }
[HttpPost("batch-insert-test")]
public async Task<bool> BatchInsertTestAsync(List<SplitPackingRecEditInput> inputs, int recordCount)
{
Stopwatch sw = new Stopwatch();
sw.Start();
List<SplitPackingRecEditInput> operLst = new List<SplitPackingRecEditInput>();
var firstObj = inputs[0];
for (int i = 1; i <= recordCount; i++)
{
var newObj = CloneSplitPackingRec(firstObj);
operLst.Add(newObj);
}
//分页
int pageSize = 50;
int pageTotal = PageHelper.GetTotalPages(operLst.Count, pageSize);
for (int i = 1; i <= pageTotal; i++)
{
var curPage = PageHelper.GetPage<SplitPackingRecEditInput>(operLst, i, pageSize);
bool ret = await _splitPackingRecApp.BatchInsertTestAsync(curPage).ConfigureAwait(false);
}
sw.Stop();
Console.WriteLine($"执行时间 = {sw.ElapsedMilliseconds} ms");
return true;
}
private static SplitPackingRecEditInput CloneSplitPackingRec(SplitPackingRecEditInput input)
{
SplitPackingRecEditInput entity = new SplitPackingRecEditInput();
entity.OprType = input.OprType;
entity.FromPackingCode = input.FromPackingCode;
//entity.FromTopPackingCode = input.FromTopPackingCode;
entity.FromStdPackQty = input.FromStdPackQty;
entity.FromUom = input.FromUom;
entity.FromQty = input.FromQty;
entity.ToPackingCode = input.ToPackingCode;
//entity.ToTopPackingCode = input.ToTopPackingCode;
entity.ToStdPackQty = input.ToStdPackQty;
entity.ToUom = input.ToUom;
entity.ToQty = input.ToQty;
entity.ItemCode = input.ItemCode;
entity.ItemName = input.ItemName;
entity.ItemDesc1 = input.ItemDesc1;
entity.ItemDesc2 = input.ItemDesc2;
entity.FromLot = input.FromLot;
entity.ToLot = input.ToLot;
entity.PurchaseInfo_PoNumber = input.PurchaseInfo_PoNumber;
entity.PurchaseInfo_AsnNumber = input.PurchaseInfo_AsnNumber;
entity.ArrivalNoticNumber = input.ArrivalNoticNumber;
entity.TaskOrderNumber = input.TaskOrderNumber;
entity.ReceiptRecNumber = input.ReceiptRecNumber;
entity.PutOnShelfNumber = input.PutOnShelfNumber;
entity.LabelType = input.LabelType;
//entity.CreationTime = input.CreationTime;
//entity.CreatorId = input.CreatorId;
//entity.LastModificationTime = input.LastModificationTime;
//entity.LastModifierId = input.LastModifierId;
entity.Remark = input.Remark;
entity.ArriveDate = input.ArriveDate;
//entity.ContainerCode = input.ContainerCode;
entity.ExpireDate = input.ExpireDate;
entity.FullBarcodeString = input.FullBarcodeString;
entity.LabelStatus = input.LabelStatus;
entity.LocationErpCode = input.LocationErpCode;
entity.PlanArriveDate = input.PlanArriveDate;
entity.ProduceDate = input.ProduceDate;
//entity.ProdLine = input.ProdLine;
//entity.Shift = input.Shift;
//entity.Team = input.Team;
entity.RpNumber = input.RpNumber;
entity.SupplierCode = input.SupplierCode;
//entity.QLevel = input.QLevel;
//entity.QualityFile = input.QualityFile;
entity.RecommendLocationCode = input.RecommendLocationCode;
//entity.Specifications = input.Specifications;
entity.SupplierBatch = input.SupplierBatch;
entity.SupplierItemCode = input.SupplierItemCode;
entity.SupplierItemName = input.SupplierItemName;
entity.SupplierName = input.SupplierName;
entity.SupplierSimpleName = input.SupplierSimpleName;
return entity;
}
} }

1
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/SplitPackings/SplitPackingRecAppService.cs

@ -151,7 +151,6 @@ public class SplitPackingRecAppService :
} }
[HttpPost("batch-insert-test")] [HttpPost("batch-insert-test")]
[UnitOfWork(IsDisabled =true)]
public async Task<bool> BatchInsertTestAsync(List<SplitPackingRecEditInput> inputs) public async Task<bool> BatchInsertTestAsync(List<SplitPackingRecEditInput> inputs)
{ {
List<SplitPackingRec> lst = ObjectMapper.Map<List<SplitPackingRecEditInput>, List<SplitPackingRec>>(inputs); List<SplitPackingRec> lst = ObjectMapper.Map<List<SplitPackingRecEditInput>, List<SplitPackingRec>>(inputs);

54
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/SplitPackings/SplitPackingRecManager.cs

@ -76,8 +76,6 @@ public class SplitPackingRecManager : DomainService, ISplitPackingRecManager
//拆箱时,如果目标箱不存在,插入目标箱(两个箱码相同) //拆箱时,如果目标箱不存在,插入目标箱(两个箱码相同)
if (hisLst3.ContainsKey(item.ToPackingCode) == false) if (hisLst3.ContainsKey(item.ToPackingCode) == false)
{ {
//SplitPackingRec newObj = CommonHelper.CloneObj(item);
//SplitPackingRec newObj = ExpressionGenericMapper<SplitPackingRec, SplitPackingRec>.Trans(item);
SplitPackingRec newObj = CloneSplitPackingRec(item); SplitPackingRec newObj = CloneSplitPackingRec(item);
newObj.SetId(GuidGenerator.Create()); newObj.SetId(GuidGenerator.Create());
newObj.OprType = OprTypeEnum.Other; newObj.OprType = OprTypeEnum.Other;
@ -94,8 +92,6 @@ public class SplitPackingRecManager : DomainService, ISplitPackingRecManager
//if (toHis == null) //if (toHis == null)
//{ //{
//} //}
//SplitPackingRec newEntity = CommonHelper.CloneObj(item);
//SplitPackingRec newEntity = ExpressionGenericMapper<SplitPackingRec, SplitPackingRec>.Trans(item);
SplitPackingRec newEntity = CloneSplitPackingRec(item); SplitPackingRec newEntity = CloneSplitPackingRec(item);
newEntity.SetId(GuidGenerator.Create()); newEntity.SetId(GuidGenerator.Create());
@ -113,8 +109,6 @@ public class SplitPackingRecManager : DomainService, ISplitPackingRecManager
{ {
item.ToTopPackingCode = item.FromPackingCode; item.ToTopPackingCode = item.FromPackingCode;
} }
//SplitPackingRec newEntity = CommonHelper.CloneObj(item);
//SplitPackingRec newEntity = ExpressionGenericMapper<SplitPackingRec, SplitPackingRec>.Trans(item);
SplitPackingRec newEntity = CloneSplitPackingRec(item); SplitPackingRec newEntity = CloneSplitPackingRec(item);
newEntity.SetId(GuidGenerator.Create()); newEntity.SetId(GuidGenerator.Create());
//var ret = await _repository.InsertAsync(newEntity, false).ConfigureAwait(false); //var ret = await _repository.InsertAsync(newEntity, false).ConfigureAwait(false);
@ -408,28 +402,38 @@ public class SplitPackingRecManager : DomainService, ISplitPackingRecManager
public async Task<bool> BatchInsertTestAsync(List<SplitPackingRec> input) public async Task<bool> BatchInsertTestAsync(List<SplitPackingRec> input)
{ {
List<SplitPackingRec> operLst = new List<SplitPackingRec>(); //List<SplitPackingRec> operLst = new List<SplitPackingRec>();
var firstObj = input[0]; //var firstObj = input[0];
int cnt = (int)(firstObj.FromStdPackQty); //int cnt = (int)(firstObj.FromStdPackQty);
for (int i = 1; i <= cnt; i++) //for (int i = 1; i <= cnt; i++)
{ //{
var newObj = CloneSplitPackingRec(firstObj); // var newObj = CloneSplitPackingRec(firstObj);
newObj.SetId(this.GuidGenerator.Create()); // newObj.SetId(this.GuidGenerator.Create());
newObj.FromTopPackingCode = newObj.FromPackingCode; // newObj.FromTopPackingCode = newObj.FromPackingCode;
newObj.ToTopPackingCode = newObj.ToPackingCode; // newObj.ToTopPackingCode = newObj.ToPackingCode;
operLst.Add(newObj); // operLst.Add(newObj);
} //}
//分页 ////分页
int pageSize = 50; //int pageSize = 50;
int pageTotal = PageHelper.GetTotalPages(operLst.Count, pageSize); //int pageTotal = PageHelper.GetTotalPages(operLst.Count, pageSize);
for (int i = 1; i <= pageTotal; i++) //for (int i = 1; i <= pageTotal; i++)
//{
// var curPage = PageHelper.GetPage<SplitPackingRec>(operLst, i, pageSize);
// bool autoSave = false;
// await _repository.InsertManyAsync(curPage, autoSave).ConfigureAwait(false);
//}
foreach(var item in input)
{ {
var curPage = PageHelper.GetPage<SplitPackingRec>(operLst, i, pageSize); item.SetId(this.GuidGenerator.Create());
bool autoSave = false; item.FromTopPackingCode = item.FromPackingCode;
await _repository.InsertManyAsync(curPage, autoSave).ConfigureAwait(false); item.ToTopPackingCode = item.ToPackingCode;
} }
bool autoSave = false;
await _repository.InsertManyAsync(input, autoSave).ConfigureAwait(false);
return true; return true;
} }

Loading…
Cancel
Save