diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/CarryBatchAddInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/CarryBatchAddInput.cs
new file mode 100644
index 00000000..4c1c1192
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/CarryBatchAddInput.cs
@@ -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
+{
+ ///
+ /// 载具批量新增输入参数
+ ///
+ public class CarryBatchAddInput
+ {
+ ///
+ /// 载具编号
+ ///
+ public string carry_code { get; set; }
+ ///
+ /// 载具分类Id
+ ///
+ public string carrystd_id { get; set; }
+ ///
+ /// 载具状态
+ ///
+ public string carry_status { get; set; } = ((int)EnumCarryStatus.空闲).ToString();
+ ///
+ /// 出库类型
+ ///
+ public string out_status { get; set; } = ((int)EnumOutStatus.正常).ToString();
+ ///
+ /// 数量
+ ///
+ public int quantity { get; set; }
+
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
index c08655d8..fcf87c52 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
@@ -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;
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsBasicConfBase`1.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsBasicConfBase`1.cs
index 0c0e5747..c1559332 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsBasicConfBase`1.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsBasicConfBase`1.cs
@@ -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
{
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs
index 70cfa3ac..dd3cdf19 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs
@@ -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;
}
+ ///
+ /// 载具批量新增
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPost, AllowAnonymous]
+ public async Task 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().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();
+ 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();
+ 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);
+ }
///
/// 条码打印
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsElevatorService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsElevatorService.cs
index 7d2850ce..d8893658 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsElevatorService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsElevatorService.cs
@@ -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
///
public class WmsElevatorService : WmsBasicConfBase
{
- public WmsElevatorService(ISqlSugarRepository repo)
- {
- DbContext = repo.AsSugarClient();
- }
+ public WmsElevatorService(ISqlSugarRepository repo) => DbContext = repo.AsSugarClient();
}
}