载具新增批量新增接口
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
{
|
||||
/// <summary>
|
||||
/// 载具批量新增输入参数
|
||||
/// </summary>
|
||||
public class CarryBatchAddInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 载具编号
|
||||
/// </summary>
|
||||
public string carry_code { get; set; }
|
||||
/// <summary>
|
||||
/// 载具分类Id
|
||||
/// </summary>
|
||||
public string carrystd_id { get; set; }
|
||||
/// <summary>
|
||||
/// 载具状态
|
||||
/// </summary>
|
||||
public string carry_status { get; set; } = ((int)EnumCarryStatus.空闲).ToString();
|
||||
/// <summary>
|
||||
/// 出库类型
|
||||
/// </summary>
|
||||
public string out_status { get; set; } = ((int)EnumOutStatus.正常).ToString();
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public int quantity { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ using JNPF.Common.Extension;
|
||||
using JNPF.Common.Manager;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aop.Api.Domain;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Contracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Entity.Constraints;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
@@ -9,12 +12,14 @@ using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.Common.Utils;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
@@ -221,6 +226,51 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
return row > 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// 载具批量新增
|
||||
/// </summary>
|
||||
/// <param name="input">
|
||||
///
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, AllowAnonymous]
|
||||
public async Task<dynamic> BatchAdd(CarryBatchAddInput input)
|
||||
{
|
||||
int i = 0, r = 0, num = 0;
|
||||
if (Regex.IsMatch(input.carry_code, @"\d+"))
|
||||
{
|
||||
num = input.carry_code.Match(@"[1-9]+").ParseToInt();
|
||||
}
|
||||
var carrys = await _db.Queryable<WmsCarryH>().Where(it => it.carry_code.Contains(input.carry_code)).ToListAsync();
|
||||
if (carrys?.Count < 1)
|
||||
{
|
||||
i = Math.Max(num, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
var lastCarry = carrys?.OrderByDescending(o => o.carry_code).FirstOrDefault() ?? default;
|
||||
num = lastCarry?.carry_code.Match(@"[1-9]+").ParseToInt() ?? -1;
|
||||
i = num + 1;
|
||||
}
|
||||
var code = input.carry_code.Match(@"\D+");
|
||||
var batchCarrys = new List<WmsCarryH>();
|
||||
for (; i <= input.quantity; i++)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(code);
|
||||
sb.Append(i.ToString().PadLeft(4, '0'));
|
||||
var carryCode = sb.ToString();
|
||||
WmsCarryH carry = input.Adapt<WmsCarryH>();
|
||||
carry.id = SnowflakeIdHelper.NextId();
|
||||
carry.carry_name = carryCode;
|
||||
carry.carry_code = carryCode;
|
||||
carry.create_id = "25398501929509";
|
||||
carry.create_time= DateTime.Now;
|
||||
batchCarrys.Add(carry);
|
||||
}
|
||||
r = await _db.Insertable(batchCarrys).ExecuteCommandAsync();
|
||||
return await Task.FromResult(r);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 条码打印
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SqlSugar;
|
||||
using SqlSugar;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
@@ -13,9 +8,6 @@ namespace Tnb.WarehouseMgr
|
||||
/// </summary>
|
||||
public class WmsElevatorService : WmsBasicConfBase<WmsElevatorH>
|
||||
{
|
||||
public WmsElevatorService(ISqlSugarRepository<WmsElevatorH> repo)
|
||||
{
|
||||
DbContext = repo.AsSugarClient();
|
||||
}
|
||||
public WmsElevatorService(ISqlSugarRepository<WmsElevatorH> repo) => DbContext = repo.AsSugarClient();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user