Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
2023-07-11 14:39:41 +08:00
2 changed files with 60 additions and 21 deletions

View File

@@ -85,7 +85,7 @@ namespace Tnb.WarehouseMgr
[HttpPost] [HttpPost]
public async Task BarCodePrint(BarCodePrintInput input) public async Task BarCodePrint(BarCodePrintInput input)
{ {
if (input == null) throw new ArgumentNullException("input"); if (input == null) throw new ArgumentNullException(nameof(input));
if (input.BillIds == null || input.BillIds.Count == 0) throw new ArgumentException($"parameter {nameof(input.BillIds)} not be null or zero"); if (input.BillIds == null || input.BillIds.Count == 0) throw new ArgumentException($"parameter {nameof(input.BillIds)} not be null or zero");
try try
{ {
@@ -161,28 +161,30 @@ namespace Tnb.WarehouseMgr
private Task<WmsTempCode> CreateInstock(WmsInstockD detail, int no) private Task<WmsTempCode> CreateInstock(WmsInstockD detail, int no)
{ {
WmsTempCode barCode = new();
barCode.org_id = detail.org_id;
barCode.material_id = detail.material_id;
barCode.material_code = detail.material_code;
var code = $"{detail.material_code}{detail.code_batch}{no.ToString().PadLeft(4, '0')}"; var code = $"{detail.material_code}{detail.code_batch}{no.ToString().PadLeft(4, '0')}";
barCode.barcode = code; WmsTempCode barCode = new()
barCode.code_batch = detail.code_batch; {
barCode.codeqty = detail.pr_qty!.Value; org_id = detail.org_id,
barCode.unit_id = detail.unit_id; material_id = detail.material_id,
barCode.is_lock = 0; material_code = detail.material_code,
barCode.is_end = 0; barcode = code,
barCode.require_id = detail.bill_id; code_batch = detail.code_batch,
barCode.require_code = _dicBillCodes.ContainsKey(detail.bill_id) ? _dicBillCodes[detail.bill_id]?.ToString() : ""; codeqty = detail.pr_qty!.Value,
barCode.create_id = _userManager.UserId; unit_id = detail.unit_id,
barCode.create_time = DateTime.Now; is_lock = 0,
is_end = 0,
require_id = detail.bill_id,
require_code = _dicBillCodes.ContainsKey(detail.bill_id) ? _dicBillCodes[detail.bill_id]?.ToString() : "",
create_id = _userManager.UserId,
create_time = DateTime.Now
};
return Task.FromResult(barCode); return Task.FromResult(barCode);
} }
public override async Task ModifyAsync(WareHouseUpInput input) public override async Task ModifyAsync(WareHouseUpInput input)
{ {
if (input == null) throw new ArgumentNullException("input"); if (input == null) throw new ArgumentNullException(nameof(input));
//更具distaskCode的barcode 更新 instockcode 的 is_end 为 1 //更具distaskCode的barcode 更新 instockcode 的 is_end 为 1
try try
{ {
@@ -351,7 +353,7 @@ namespace Tnb.WarehouseMgr
List<WmsPretaskCode> pretaskCodes = new(); List<WmsPretaskCode> pretaskCodes = new();
foreach (var pt in preTasks) foreach (var pt in preTasks)
{ {
if (instockCOdes.Count() > 0) if (instockCOdes.Count > 0)
{ {
foreach (var jo in instockCOdes) foreach (var jo in instockCOdes)
{ {
@@ -377,9 +379,9 @@ namespace Tnb.WarehouseMgr
var preTaskUpInput = new GenPreTaskUpInput(); var preTaskUpInput = new GenPreTaskUpInput();
preTaskUpInput.RquireId = instock.id; preTaskUpInput.RquireId = instock.id;
preTaskUpInput.CarryId = instock.carry_id!; preTaskUpInput.CarryId = instock.carry_id!;
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!; preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()?.location_id;
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!; preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()?.location_code;
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!; preTaskUpInput.LocationIds = (points?.Select(x => x.location_id)?.ToList() ?? Enumerable.Empty<string?>().ToList()) as List<string>;
//创建预任务操作记录 //创建预任务操作记录
var operBillId = string.Empty; var operBillId = string.Empty;
@@ -393,7 +395,7 @@ namespace Tnb.WarehouseMgr
preTaskUpInput.PreTaskRecord = handleH; preTaskUpInput.PreTaskRecord = handleH;
} }
//创建预任务条码操作记录 //创建预任务条码操作记录
if (instockcodes != null && instockcodes.Count() > 0) if (instockcodes?.Count > 0)
{ {
foreach (var jo in instockcodes) foreach (var jo in instockcodes)
{ {

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Options;
using Swashbuckle.AspNetCore.SwaggerUI;
namespace Tnb.Common.Options
{
public class ConfigureSwaggerUIOptions : IConfigureOptions<SwaggerUIOptions>
{
private readonly IWebHostEnvironment _hostingEnvironment;
public ConfigureSwaggerUIOptions(IWebHostEnvironment hostingEnvironment)
{
_hostingEnvironment = hostingEnvironment;
}
public void Configure(SwaggerUIOptions options)
{
// Configure SwaggerUI options
options.DefaultModelExpandDepth(2);
options.DefaultModelRendering(ModelRendering.Example);
options.DocExpansion(DocExpansion.List);
options.EnableDeepLinking();
options.DisplayOperationId();
options.EnableFilter();
options.MaxDisplayedTags(5);
options.ShowExtensions();
}
}
}