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.
 
 
 
 
 
 

153 lines
5.9 KiB

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Json;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Basedata.Commons;
using Win_in.Sfs.Basedata.Domain;
namespace Win_in.Sfs.Wms.Pda.Controllers.BaseDatas;
/// <summary>
/// 字典控制器
/// </summary>
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}split-packing-rec")]
public class SplitPackingRecController : AbpController
{
private readonly ISplitPackingRecAppService _splitPackingRecApp;
/// <summary>
///
/// </summary>
/// <param name="splitPackingRecApp"></param>
public SplitPackingRecController(ISplitPackingRecAppService splitPackingRecApp, IOptions<AbpJsonOptions> options)
{
_splitPackingRecApp = splitPackingRecApp;
var str = options.Value.DefaultDateTimeFormat;
Console.WriteLine(str);
}
/// <summary>
/// 取拆分记录列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("get-all")]
public virtual async Task<List<SplitPackingRecDTO>> GetAllListByFilterAsync(SfsBaseDataRequestInputBase input)
{
return await _splitPackingRecApp.GetAllListByFilterAsync(input).ConfigureAwait(false);
}
/// <summary>
/// 获取拆箱记录
/// </summary>
/// <param name="toPackingCode">目标箱码列表</param>
/// <returns></returns>
[HttpGet("get-split-packing-code")]
public async Task<SplitPackingRecDTO> GetSplitPackingCode(string toPackingCode)
{
return await _splitPackingRecApp.GetSplitPackingCode(toPackingCode).ConfigureAwait(false);
}
/// <summary>
/// 根据to箱码取所有具有相同箱码的拆箱记录
/// </summary>
/// <param name="toPackingCode"></param>
/// <returns></returns>
[HttpGet("get-same-ponumber-list-by-topackingcode")]
public async Task<List<SplitPackingRecDTO>> GetSamePoNumberListByToPackingCode(string toPackingCode)
{
return await _splitPackingRecApp.GetSamePoNumberListByToPackingCode(toPackingCode).ConfigureAwait(false);
}
[HttpPost("batch-insert-test")]
public async Task<bool> BatchInsertTestAsync(List<SplitPackingRecEditInput> inputs, int recordCount, int pageSize = 50)
{
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 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;
}
}