diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs
index 69c6412f..df27ba8e 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs
@@ -121,6 +121,10 @@ public class ModuleConsts
///
public const string MODULE_WMSCARRYREPLACE_ID = "26188532491557";//26188532491557
///
+ /// 模块标识-人工空载具入库 todo
+ ///
+ public const string MODULE_WMSEMPTYCARRYINSTOCK_ID = "MODULE_WMSEMPTYCARRYINSTOCK_ID";//
+ ///
/// 模块标识-齐套分拣
///
public const string MODULE_WMSSETSORTING_ID = "26172520979237";
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WmsEmptycarryInstockServiceInstockInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WmsEmptycarryInstockServiceInstockInput.cs
new file mode 100644
index 00000000..1a86a9cf
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WmsEmptycarryInstockServiceInstockInput.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tnb.WarehouseMgr.Entities.Consts;
+
+namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
+{
+ public class WmsEmptycarryInstockServiceInstockInput
+ {
+ public string carry_code { get; set; }
+ public string location_code { get; set; }
+ public string org_id { get; set; } = WmsWareHouseConst.AdministratorOrgId;
+ public string create_id { get; set; } = WmsWareHouseConst.AdministratorUserId;
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsEmptycarryInstockLog.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsEmptycarryInstockLog.cs
new file mode 100644
index 00000000..6ccfd3f6
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsEmptycarryInstockLog.cs
@@ -0,0 +1,52 @@
+using JNPF.Common.Contracts;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.WarehouseMgr.Entities.Entity;
+
+///
+/// 空托盘入库及记录
+///
+[SugarTable("wms_emptycarry_instock_log")]
+public partial class WmsEmptycarryInstockLog : BaseEntity
+{
+ public WmsEmptycarryInstockLog()
+ {
+ id = SnowflakeIdHelper.NextId();
+ }
+ ///
+ /// 创建用户
+ ///
+ public string? create_id { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime? create_time { get; set; }
+
+ ///
+ /// 所属组织
+ ///
+ public string? org_id { get; set; }
+
+ ///
+ /// 入库库位id
+ ///
+ public string? location_id { get; set; }
+
+ ///
+ /// 入库库位编码
+ ///
+ public string? location_code { get; set; }
+
+ ///
+ /// 载具id
+ ///
+ public string? carry_id { get; set; }
+
+ ///
+ /// 载具编码
+ ///
+ public string? carry_code { get; set; }
+
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsEmptycarryInstockLogService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsEmptycarryInstockLogService.cs
new file mode 100644
index 00000000..d2bbb5e0
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsEmptycarryInstockLogService.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tnb.WarehouseMgr.Entities.Dto.Inputs;
+
+namespace Tnb.WarehouseMgr.Interfaces
+{
+
+ public interface IWmsEmptycarryInstockLogService
+ {
+ Task Instock(WmsEmptycarryInstockServiceInstockInput input);
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptycarryInstockLogService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptycarryInstockLogService.cs
new file mode 100644
index 00000000..96dc1938
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptycarryInstockLogService.cs
@@ -0,0 +1,117 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using JNPF.Common.Core.Manager;
+using JNPF.Common.Dtos.VisualDev;
+using Mapster;
+using Microsoft.AspNetCore.Mvc;
+using SqlSugar;
+using Tnb.Common.Utils;
+using Tnb.QcMgr.Entities.Enums;
+using Tnb.QcMgr.Entities;
+using Tnb.WarehouseMgr.Entities;
+using Tnb.WarehouseMgr.Entities.Dto;
+using Tnb.WarehouseMgr.Entities.Dto.Inputs;
+using Tnb.WarehouseMgr.Interfaces;
+using Tnb.QcMgr.Interfaces;
+using Tnb.WarehouseMgr.Entities.Consts;
+using JNPF.Common.Enums;
+using JNPF.FriendlyException;
+using Microsoft.Extensions.Logging;
+using Tnb.ProductionMgr.Entities;
+using Tnb.WarehouseMgr.Entities.Entity;
+using Npgsql;
+using Tnb.WarehouseMgr.Entities.Enums;
+using Tnb.ProductionMgr.Entities.Dto;
+using JNPF.VisualDev;
+using System.Runtime.InteropServices;
+using Tnb.BasicData.Entities;
+
+namespace Tnb.WarehouseMgr
+{
+ [OverideVisualDev(ModuleConsts.MODULE_WMSEMPTYCARRYINSTOCK_ID)]
+ public class WmsEmptycarryInstockLogService : BaseWareHouseService,IWmsEmptycarryInstockLogService
+ {
+ private readonly ISqlSugarClient _db;
+ public WmsEmptycarryInstockLogService(ISqlSugarRepository repository)
+ {
+ _db = repository.AsSugarClient();
+ }
+
+ ///
+ /// 人工空托盘入库
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task Instock(WmsEmptycarryInstockServiceInstockInput input)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(input.location_code))
+ {
+ throw new Exception("请扫描入库库位");
+ }
+ if (string.IsNullOrEmpty(input.carry_code))
+ {
+ throw new Exception("请扫描载具");
+ }
+ await _db.Ado.BeginTranAsync();
+
+ WmsCarryH wmsCarryH = await _db.Queryable().Where(r => r.carry_code == input.carry_code).FirstAsync();
+ BasLocation basLocation = await _db.Queryable().Where(r => r.location_code == input.location_code).FirstAsync();
+
+ if (wmsCarryH.is_lock == 1)
+ {
+ throw new Exception($"载具{wmsCarryH.carry_code}已锁定");
+ }
+ if (wmsCarryH.carry_status == "1")
+ {
+ throw new Exception($"载具{wmsCarryH.carry_code}已占用");
+ }
+
+ if (basLocation.is_lock == 1)
+ {
+ throw new Exception($"库位{basLocation.location_code}已锁定");
+ }
+ if (basLocation.is_use == "1")
+ {
+ throw new Exception($"库位{basLocation.location_code}已占用");
+ }
+
+ wmsCarryH.location_id = basLocation.id;
+ wmsCarryH.location_code = basLocation.location_code;
+
+ basLocation.is_use = "1";
+
+ await _db.Updateable(wmsCarryH).UpdateColumns(r => new { r.location_id , r.location_code}).ExecuteCommandAsync();
+ await _db.Updateable(basLocation).UpdateColumns(r => new { r.is_use }).ExecuteCommandAsync();
+
+ WmsEmptycarryInstockLog wmsEmptycarryInstockLog = new WmsEmptycarryInstockLog();
+ wmsEmptycarryInstockLog.carry_id = wmsCarryH.id;
+ wmsEmptycarryInstockLog.carry_code = wmsCarryH.carry_code;
+ wmsEmptycarryInstockLog.location_id = basLocation.id;
+ wmsEmptycarryInstockLog.location_code = basLocation.location_code;
+ wmsEmptycarryInstockLog.org_id = input.org_id;
+ wmsEmptycarryInstockLog.create_id =input.create_id ;
+ wmsEmptycarryInstockLog.create_time = DateTime.Now;
+
+ await _db.Insertable(wmsEmptycarryInstockLog).ExecuteCommandAsync();
+
+ await _db.Ado.CommitTranAsync();
+ return await ToApiResult(HttpStatusCode.OK, "成功");
+ }
+ catch (Exception ex)
+ {
+ Logger.LogInformation("【WmsEmptycarryInstockService-Instock】" + ex.Message);
+ Logger.LogInformation("【WmsEmptycarryInstockService-Instock】" + ex.StackTrace);
+ await _db.Ado.RollbackTranAsync();
+ return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
+ }
+ }
+ }
+}