diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs
new file mode 100644
index 00000000..c91082dc
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.WarehouseMgr.Entities.Consts
+{
+ public class WmsWareHouseConst
+ {
+ ///
+ /// 出入库单据状态TypeID
+ ///
+ public const string WMS_INSTOCK_D_BILL_STATUS_TYPEID = "25065133038101";
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ExChangeCarryInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ExChangeCarryInput.cs
similarity index 100%
rename from WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ExChangeCarryInput.cs
rename to WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ExChangeCarryInput.cs
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/InOutStockApplyforUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/InOutStockApplyforUpInput.cs
similarity index 97%
rename from WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/InOutStockApplyforUpInput.cs
rename to WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/InOutStockApplyforUpInput.cs
index 609401fa..b3124df2 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/InOutStockApplyforUpInput.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/InOutStockApplyforUpInput.cs
@@ -14,6 +14,10 @@ namespace Tnb.WarehouseMgr.Entities.Dto
{
// bill_line,location_id,delivery_date,carry_id,carry_code
///
+ /// 出入库明细Id
+ ///
+ public string id { get; set; }
+ ///
/// 出入库申请类型 1、入库 2、出库
///
public EnumInOutStockType inoutStockType { get; set; }
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/CarryCodeDetailOutput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CarryCodeDetailOutput.cs
similarity index 100%
rename from WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/CarryCodeDetailOutput.cs
rename to WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CarryCodeDetailOutput.cs
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/InStockDetailOutput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/InStockDetailOutput.cs
similarity index 78%
rename from WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/InStockDetailOutput.cs
rename to WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/InStockDetailOutput.cs
index bc562eb5..67bd2796 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/InStockDetailOutput.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/InStockDetailOutput.cs
@@ -14,6 +14,10 @@ namespace Tnb.WarehouseMgr.Entities.Dto
///
/// 入库单明细Id
///
+ public string id { get; set; }
+ ///
+ /// 入库单Id
+ ///
public string bill_id { get; set; }
///
/// 单位id
@@ -52,6 +56,14 @@ namespace Tnb.WarehouseMgr.Entities.Dto
///
public decimal? tax_price { get; set; }
///
+ /// 不含税金额
+ ///
+ public decimal? amount { get; set; }
+ ///
+ /// 含税金额
+ ///
+ public decimal? all_amount { get; set; }
+ ///
/// 已打印数量
///
public int print_qty { get; set; }
@@ -60,6 +72,10 @@ namespace Tnb.WarehouseMgr.Entities.Dto
///
public int scan_qty { get; set; }
///
+ /// 物品代码
+ ///
+ public string material_code { get; set; } = string.Empty;
+ ///
/// 条码明细
///
public List CodeDetails { get; set; }
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/OutStockDetailOutput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/OutStockDetailOutput.cs
new file mode 100644
index 00000000..bb530b10
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/OutStockDetailOutput.cs
@@ -0,0 +1,155 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.WarehouseMgr.Entities.Dto
+{
+ ///
+ /// 出库库单据物料明细信息
+ ///
+ public class OutStockDetailOutput
+ {
+ ///
+ /// 出库单明细Id
+ ///
+ public string id { get; set; }
+ ///
+ /// 出库单ID
+ ///
+ public string bill_id { get; set; } = string.Empty;
+
+ ///
+ /// 明细状态
+ ///
+ public string line_status { get; set; } = string.Empty;
+
+ ///
+ /// 库位ID
+ ///
+ public string? location_id { get; set; }
+
+ ///
+ /// 物品ID
+ ///
+ public string? material_id { get; set; }
+
+ ///
+ /// 物品代码
+ ///
+ public string material_code { get; set; } = string.Empty;
+
+ ///
+ /// 单位ID
+ ///
+ public string unit_id { get; set; } = string.Empty;
+
+ ///
+ /// 单位代码
+ ///
+ public string? unit_code { get; set; }
+
+ ///
+ /// 出库需求数量
+ ///
+ public decimal pr_qty { get; set; }
+
+ ///
+ /// 实际出库数量
+ ///
+ public decimal qty { get; set; }
+
+ ///
+ /// 要求出库日期(销售出库为交期)
+ ///
+ public DateTime? delivery_date { get; set; }
+
+ ///
+ /// 发料仓库
+ ///
+ public string? warehouse_id { get; set; }
+
+ ///
+ /// 不含税单价
+ ///
+ public decimal? price { get; set; }
+
+ ///
+ /// 含税单价
+ ///
+ public decimal? tax_price { get; set; }
+
+ ///
+ /// 不含税金额
+ ///
+ public decimal? amount { get; set; }
+
+ ///
+ /// 含税金额
+ ///
+ public decimal? all_amount { get; set; }
+
+ ///
+ /// 来源单据ID
+ ///
+ public string? source_id { get; set; }
+
+ ///
+ /// 来源单单据类型
+ ///
+ public int? source_type { get; set; }
+
+ ///
+ /// 来源单据行号
+ ///
+ public int? source_line { get; set; }
+
+ ///
+ /// 来源单据明细ID
+ ///
+ public string? source_detail_id { get; set; }
+
+ ///
+ /// 生产工单号
+ ///
+ public string? mo_code { get; set; }
+
+ ///
+ /// 生产工单BOM明细Id
+ ///
+ public string? mo_bom_detail_id { get; set; }
+
+ ///
+ /// 生产工单行号
+ ///
+ public int? mo_line { get; set; }
+
+ ///
+ /// 打印数量
+ ///
+ public decimal? print_qty { get; set; }
+
+ ///
+ /// 扫描数量
+ ///
+ public decimal? scan_qty { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string? remark { get; set; }
+
+
+
+ ///
+ /// 批次
+ ///
+ public string? code_batch { get; set; }
+
+ ///
+ /// 条码明细
+ ///
+ public List CodeDetails { get; set; }
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/InOutStockDetailQuery.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/InOutStockDetailQuery.cs
similarity index 100%
rename from WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/InOutStockDetailQuery.cs
rename to WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/InOutStockDetailQuery.cs
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/InStockStrategyQuery.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/InStockStrategyQuery.cs
new file mode 100644
index 00000000..54064105
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/InStockStrategyQuery.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.WarehouseMgr.Entities.Dto
+{
+ ///
+ /// 入库策略输入参数
+ ///
+ public class InStockStrategyQuery
+ {
+ ///
+ /// 仓库Id
+ ///
+ public string warehouse_id { get; set; }
+ ///
+ /// 物料Id
+ ///
+ public string material_id { get; set; }
+ ///
+ /// 批次
+ ///
+ public string code_batch { get; set; }
+ ///
+ /// 业务类型s
+ ///
+ public int BllType { get; set; }
+
+ public int Size { get; set; }
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/OutStockStrategyQuery.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/OutStockStrategyQuery.cs
new file mode 100644
index 00000000..e4d9fae2
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/OutStockStrategyQuery.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.WarehouseMgr.Entities.Dto
+{
+ internal class OutStockStrategyQuery
+ {
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockD.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockD.cs
index a1e08fec..e9f779da 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockD.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockD.cs
@@ -27,7 +27,7 @@ public partial class WmsInstockD : BaseEntity
///
/// 执行状态
///
- public string line_status { get; set; } = string.Empty;
+ public string line_status { get; set; }
///
/// 物品ID
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockD.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockD.cs
index ca9a869b..27334e79 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockD.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockD.cs
@@ -17,32 +17,27 @@ public partial class WmsOutstockD : BaseEntity
///
/// 所属组织ID
///
- public string org_id { get; set; } = string.Empty;
+ public string? org_id { get; set; }
///
/// 出库单ID
///
public string bill_id { get; set; } = string.Empty;
- ///
- /// 行号
- ///
- public int bill_line { get; set; }
-
///
/// 明细状态
///
- public int line_status { get; set; }
+ public string line_status { get; set; } = string.Empty;
///
/// 库位ID
///
- public string location_id { get; set; } = string.Empty;
+ public string? location_id { get; set; }
///
/// 物品ID
///
- public string material_id { get; set; } = string.Empty;
+ public string? material_id { get; set; }
///
/// 物品代码
@@ -57,7 +52,7 @@ public partial class WmsOutstockD : BaseEntity
///
/// 单位代码
///
- public string unit_code { get; set; } = string.Empty;
+ public string? unit_code { get; set; }
///
/// 出库需求数量
@@ -72,12 +67,12 @@ public partial class WmsOutstockD : BaseEntity
///
/// 要求出库日期(销售出库为交期)
///
- public DateTime delivery_date { get; set; } = DateTime.Now;
+ public DateTime? delivery_date { get; set; }
///
/// 发料仓库
///
- public string warehouse_id { get; set; } = string.Empty;
+ public string? warehouse_id { get; set; }
///
/// 不含税单价
@@ -137,12 +132,12 @@ public partial class WmsOutstockD : BaseEntity
///
/// 打印数量
///
- public decimal print_qty { get; set; }
+ public decimal? print_qty { get; set; }
///
/// 扫描数量
///
- public decimal scan_qty { get; set; }
+ public decimal? scan_qty { get; set; }
///
/// 备注
@@ -162,12 +157,12 @@ public partial class WmsOutstockD : BaseEntity
///
/// 创建用户
///
- public string create_id { get; set; } = string.Empty;
+ public string? create_id { get; set; }
///
/// 创建时间
///
- public DateTime create_time { get; set; } = DateTime.Now;
+ public DateTime? create_time { get; set; }
///
/// 修改用户
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPointH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPointH.cs
index 01dcbecc..80a81867 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPointH.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPointH.cs
@@ -108,5 +108,8 @@ public partial class WmsPointH : BaseEntity
/// 时间戳(用于并发控制)
///
public DateTime? timestamp { get; set; }
-
+ ///
+ /// 楼层
+ ///
+ public int floor { get; set; }
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Mapper/Mapper.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Mapper/Mapper.cs
new file mode 100644
index 00000000..5c372afe
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Mapper/Mapper.cs
@@ -0,0 +1,18 @@
+using Mapster;
+using Tnb.WarehouseMgr.Entities;
+using Tnb.WarehouseMgr.Entities.Dto;
+
+namespace Tnb.WarehouseMgr.Entities.Mapper
+{
+ public class Mapper : IRegister
+ {
+ public void Register(TypeAdapterConfig config)
+ {
+ //config.ForType()
+ // .Map(dest => dest.id, src => src.bill_id);
+ //config.ForType()
+ // .Map(dest => dest.id, src => src.bill_id);
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWareHouseService.cs
index 3b7f5f97..af004e7e 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWareHouseService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWareHouseService.cs
@@ -3,6 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Tnb.BasicData.Entities;
+using Tnb.WarehouseMgr.Entities;
+using Tnb.WarehouseMgr.Entities.Dto;
namespace Tnb.WarehouseMgr.Interfaces
{
@@ -11,5 +15,24 @@ namespace Tnb.WarehouseMgr.Interfaces
///
public interface IWareHouseService
{
+ ///
+ /// 入库策略
+ ///
+ ///
+ ///
+ Task> InStockStrategy([FromQuery] InStockStrategyQuery input);
+ ///
+ /// 路径算法
+ ///
+ ///
+ ///
+ ///
+ Task> PathAlgorithms(string pStartId, string pEndId);
+ ///
+ /// 生成预任务
+ ///
+ ///
+ ///
+ Task GenPreTask(List preTasks);
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsOutStockService.cs
new file mode 100644
index 00000000..004b2d31
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsOutStockService.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.WarehouseMgr.Interfaces
+{
+ ///
+ /// 出库申请业务接口
+ ///
+ public interface IWmsOutStockService
+ {
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/Tnb.WarehouseMgr.Interfaces.csproj b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/Tnb.WarehouseMgr.Interfaces.csproj
index 6a1e6e38..5ac5165a 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/Tnb.WarehouseMgr.Interfaces.csproj
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/Tnb.WarehouseMgr.Interfaces.csproj
@@ -8,6 +8,7 @@
+
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/BaseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs
similarity index 84%
rename from WarehouseMgr/Tnb.WarehouseMgr/BaseService.cs
rename to WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs
index 62cc06af..5ddaae56 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/BaseService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs
@@ -13,7 +13,7 @@ namespace Tnb.WarehouseMgr
{
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
[Route("api/[area]/[controller]/[action]")]
- public class BaseService : IOverideVisualDevService, IDynamicApiController, ITransient
+ public class BaseWareHouseService : IOverideVisualDevService, IDynamicApiController, ITransient
{
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
index f3e9e677..4cb42d8a 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
@@ -2,9 +2,11 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
+using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Aspose.Cells.Drawing;
+using Dm;
using JNPF.Common.Contracts;
using JNPF.Common.Enums;
using JNPF.Common.Extension;
@@ -13,6 +15,7 @@ using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.Extras.CollectiveOAuth.Config;
using JNPF.FriendlyException;
+using JNPF.Systems.Interfaces.System;
using Mapster;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
@@ -25,7 +28,9 @@ using Tnb.BasicData.Entities;
using Tnb.BasicData.Entities.Enums;
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.Enums;
using Tnb.WarehouseMgr.Interfaces;
@@ -34,14 +39,14 @@ namespace Tnb.WarehouseMgr
///
/// 库房业务类(出入库)
///
- [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
- [Route("api/[area]/[controller]/[action]")]
- public class WareHouseService : IWareHouseService, IDynamicApiController, ITransient
+ public class WareHouseService : BaseWareHouseService, IWareHouseService
{
private readonly ISqlSugarClient _db;
- public WareHouseService(ISqlSugarRepository repository)
+ private readonly IDictionaryDataService _dictionaryDataService;
+ public WareHouseService(ISqlSugarRepository repository, IDictionaryDataService dictionaryDataService)
{
_db = repository.AsSugarClient();
+ _dictionaryDataService = dictionaryDataService;
}
///
/// 根据载具Id带出库位、仓库信息
@@ -93,26 +98,34 @@ namespace Tnb.WarehouseMgr
case EnumInOutStockType.In:
var wmsInstockD = input.Adapt();
var wmsInstockCodes = input.InstockCodes.Adapt>();
- wmsInstockCodes.ForEach(x =>
+ if (wmsInstockCodes?.Count > 0)
{
- if (x.id.IsNullOrWhiteSpace())
+ wmsInstockCodes.ForEach(x =>
{
- x.id = SnowflakeIdHelper.NextId();
- }
- });
- isOk = await _update(wmsInstockD, wmsInstockCodes);
+ if (x.id.IsNullOrWhiteSpace())
+ {
+ x.id = SnowflakeIdHelper.NextId();
+ }
+ x.bill_d_id = wmsInstockD.id;
+ });
+ }
+ isOk = await _update(wmsInstockD, wmsInstockCodes);
break;
case EnumInOutStockType.Out:
var wmsOutstockD = input.Adapt();
var wmsOutstockCodes = input.InstockCodes.Adapt>();
- wmsOutstockCodes.ForEach(x =>
+ if (wmsOutstockCodes?.Count > 0)
{
- if (x.id.IsNullOrWhiteSpace())
+ wmsOutstockCodes.ForEach(x =>
{
- x.id = SnowflakeIdHelper.NextId();
- }
- });
- isOk = await _update(wmsOutstockD, wmsOutstockCodes);
+ if (x.id.IsNullOrWhiteSpace())
+ {
+ x.id = SnowflakeIdHelper.NextId();
+ }
+ x.bill_d_id = wmsOutstockD.id;
+ });
+ }
+ isOk = await _update(wmsOutstockD, wmsOutstockCodes);
break;
}
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
@@ -126,6 +139,7 @@ namespace Tnb.WarehouseMgr
public async Task GetInOutStockCodesById([FromQuery] InOutStockDetailQuery input)
{
dynamic result = null;
+ var dic = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_INSTOCK_D_BILL_STATUS_TYPEID);
switch (input.inoutStockType)
{
case EnumInOutStockType.In:
@@ -133,7 +147,8 @@ namespace Tnb.WarehouseMgr
.Where(a => a.id == input.bill_d_id)
.Select(a => new InStockDetailOutput
{
- bill_id = a.id,
+ id = a.id,
+ bill_id = a.bill_id,
unit_id = a.unit_id,
code_batch = a.code_batch,
warehouse_id = a.warehouse_id,
@@ -145,32 +160,69 @@ namespace Tnb.WarehouseMgr
tax_price = a.tax_price,
print_qty = a.print_qty,
scan_qty = a.scan_qty,
+ material_code = a.material_code,
+ amount = a.amount,
+ all_amount = a.all_amount,
CodeDetails = SqlFunc.Subqueryable().Where(it => it.bill_d_id == a.id).ToList(),
- }).ToListAsync();
+ })
+ .Mapper(it => it.line_status = dic.ContainsKey(it.line_status) ? dic[it.line_status]?.ToString()! : "")
+ .ToListAsync();
break;
case EnumInOutStockType.Out:
- result = await _db.Queryable().Where(it => it.bill_d_id == input.bill_d_id).ToListAsync();
+ result = await _db.Queryable()
+ .Where(a => a.id == input.bill_d_id)
+ .Select(a => new OutStockDetailOutput
+ {
+ id = a.id,
+ bill_id = a.bill_id,
+ unit_id = a.unit_id,
+ code_batch = a.code_batch,
+ warehouse_id = a.warehouse_id,
+ line_status = a.line_status,
+ price = a.price,
+ tax_price = a.tax_price,
+ material_code = a.material_code,
+ amount = a.amount,
+ all_amount = a.all_amount,
+ CodeDetails = SqlFunc.Subqueryable().Where(it => it.bill_d_id == a.id).ToList(),
+ })
+ .Mapper(it => it.line_status = dic.ContainsKey(it.line_status) ? dic[it.line_status]?.ToString()! : "")
+ .ToListAsync();
break;
}
return result;
}
-
- private async Task _update(T1 entity, List entities) where T1 : BaseEntity, new() where T2 : BaseEntity, new()
+ ///
+ /// 入库策略
+ ///
+ ///
+ [HttpGet]
+ public async Task> InStockStrategy([FromQuery] InStockStrategyQuery input)
{
- var isOk = false;
- try
- {
- await _db.Ado.BeginTranAsync();
- isOk = await _db.Updateable(entity).ExecuteCommandHasChangeAsync();
- isOk = await _db.Updateable(entities).ExecuteCommandHasChangeAsync();
- await _db.Ado.CommitTranAsync();
- }
- catch (Exception)
- {
- await _db.Ado.RollbackTranAsync();
- }
- return isOk;
+ var items = await _db.Queryable().Where(it => it.wh_id == input.warehouse_id && it.is_lock == 0 && it.is_use == "0" && it.is_type == "0").OrderBy(it => new { it.layers, it.loc_line, it.loc_column }, OrderByType.Asc).ToListAsync();
+ return items.Take(input.Size).ToList();
+ }
+ ///
+ /// 出库策略
+ ///
+ ///
+ [HttpGet]
+ public async Task OutStockStrategy()
+ {
+ return Task.FromResult(true);
+ }
+
+ ///
+ /// 生成预任务
+ ///
+ ///
+ ///
+ ///
+ public async Task GenPreTask(List preTasks)
+ {
+ var row = await _db.Insertable(preTasks).ExecuteCommandAsync();
+ return row > 0;
}
///
@@ -179,13 +231,16 @@ namespace Tnb.WarehouseMgr
///
///
///
- [HttpGet]
- public async Task PathAlgorithms(string pStartId, string pEndId)
+
+ public async Task> PathAlgorithms(string pStartId, string pEndId)
{
var roads = await _db.Queryable().ToListAsync();
- await LocPathCalcAlgorithms(pStartId, pEndId, roads);
+ var points = await LocPathCalcAlgorithms(pStartId, pEndId, roads);
+ return points;
}
- private async Task LocPathCalcAlgorithms(string pStartId, string pEndId, List roads)
+
+ #region PrivateMethods
+ private async Task> LocPathCalcAlgorithms(string pStartId, string pEndId, List roads)
{
var points = await _db.Queryable().ToListAsync();
var startObj = points.Find(x => x.id == pStartId);
@@ -216,7 +271,7 @@ namespace Tnb.WarehouseMgr
isVisited[pStartId] = true;
MatchPoint(results, roads, shortestPathPoints, isVisited, pStartId, pEndId);
results.Add(endObj);
- string str = null;
+ return results;
}
///
/// 获取匹配的最短路径节点
@@ -258,5 +313,29 @@ namespace Tnb.WarehouseMgr
index = prev[index];
}
}
+
+ private async Task _update(T1 entity, List entities) where T1 : BaseEntity, new() where T2 : BaseEntity, new()
+ {
+ var isOk = false;
+ try
+ {
+ //await _db.Ado.BeginTranAsync();
+ isOk = await _db.Updateable(entity).ExecuteCommandHasChangeAsync();
+ if (entities?.Count > 0)
+ {
+ var row = await _db.Storageable(entities).ExecuteCommandAsync();
+ isOk = row > 0;
+ }
+ //await _db.Ado.CommitTranAsync();
+ }
+ catch (Exception)
+ {
+ //await _db.Ado.RollbackTranAsync();
+ }
+ return isOk;
+ }
+
+
+ #endregion
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs
new file mode 100644
index 00000000..eeabb7f2
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using JNPF.Common.Dtos.VisualDev;
+using JNPF.VisualDev;
+using JNPF.VisualDev.Entitys;
+using JNPF.VisualDev.Interfaces;
+using Microsoft.AspNetCore.Mvc;
+using SqlSugar;
+using Tnb.BasicData.Entities;
+using Tnb.WarehouseMgr.Entities;
+using Tnb.WarehouseMgr.Entities.Dto;
+using Tnb.WarehouseMgr.Interfaces;
+
+namespace Tnb.WarehouseMgr
+{
+ ///
+ /// 载具移入
+ ///
+ [OverideVisualDev(ModuleId)]
+ public class WmsCarryMoveInStockService : BaseWareHouseService
+ {
+ private const string ModuleId = "26122102481957";
+ private readonly ISqlSugarClient _db;
+ private readonly IRunService _runService;
+ private readonly IVisualDevService _visualDevService;
+ private readonly IWareHouseService _wareHouseService;
+ public WmsCarryMoveInStockService(
+ ISqlSugarRepository repository,
+ IRunService runService,
+ IVisualDevService visualDevService,
+ IWareHouseService wareHouseService)
+ {
+ _db = repository.AsSugarClient();
+ _runService = runService;
+ _visualDevService = visualDevService;
+ _wareHouseService = wareHouseService;
+ OverideFuncs.CreateAsync = CarryMoveIn;
+ }
+
+ private async Task CarryMoveIn(VisualDevModelDataCrInput input)
+ {
+ VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
+ await _runService.Create(templateEntity, input);
+ //入库取终点
+ var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString(), Size = 1 };
+ var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
+ WmsPointH sPoint = null;
+ WmsPointH ePoint = null;
+ if (input.data.ContainsKey(nameof(WmsPointH.location_id)))
+ {
+ sPoint = await _db.Queryable().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
+ }
+ if (endLocations?.Count > 0)
+ {
+ ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id);
+ }
+ if (sPoint != null && ePoint != null)
+ {
+ var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
+ //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
+ //根据载具移入Id,回更单据状态
+ //根据生成的预任务,插入预任务操作记录
+ //根据载具ID,更新是否锁定和赋值起始库位
+ //根据所有库位更新库位的锁定状态为“锁定”
+ }
+ return Task.FromResult(1);
+ }
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs
index 1f341320..6ccbf91d 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs
@@ -15,7 +15,7 @@ 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.Enums;
using Tnb.WarehouseMgr.Interfaces;
@@ -24,10 +24,8 @@ namespace Tnb.WarehouseMgr
///
/// 载具服务
///
- [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
- [Route("api/[area]/[controller]/[action]")]
[OverideVisualDev(ModuleId)]
- public class WmsCarryService : IOverideVisualDevService, IWmsCarryService, IDynamicApiController, ITransient
+ public class WmsCarryService : BaseWareHouseService, IWmsCarryService
{
private const string ModuleId = "26188532491557";
private readonly ISqlSugarClient _db;
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs
index 606eb09a..dbf2277d 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs
@@ -23,7 +23,7 @@ namespace Tnb.WarehouseMgr
/// 齐套配套方案服务
///
[OverideVisualDev(ModuleId)]
- public class WmsCollocationSchemeSevice : BaseService, IWmsCollocationSchemeSevice
+ public class WmsCollocationSchemeSevice : BaseWareHouseService, IWmsCollocationSchemeSevice
{
private const string ModuleId = "26167204892965";
private readonly ISqlSugarClient _db;
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsFeedingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsFeedingService.cs
index 03e99b46..df1727ef 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsFeedingService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsFeedingService.cs
@@ -18,7 +18,7 @@ namespace Tnb.WarehouseMgr
///
/// 投料记录
///
- public class WmsFeedingService : BaseService, IWmsFeedingService
+ public class WmsFeedingService : BaseWareHouseService, IWmsFeedingService
{
private readonly ISqlSugarClient _db;
private static Dictionary dicMaterial = new Dictionary();
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs
index 3df9e321..104e1a14 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs
@@ -3,9 +3,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using JNPF.Systems.Interfaces.System;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Tnb.WarehouseMgr.Entities;
+using Tnb.WarehouseMgr.Entities.Consts;
using Tnb.WarehouseMgr.Interfaces;
namespace Tnb.WarehouseMgr
@@ -13,13 +15,14 @@ namespace Tnb.WarehouseMgr
///
/// 入库申请服务
///
- public class WmsInStockService : BaseService, IWmsInStockService
+ public class WmsInStockService : BaseWareHouseService, IWmsInStockService
{
private readonly ISqlSugarClient _db;
-
- public WmsInStockService(ISqlSugarRepository repository)
+ private readonly IDictionaryDataService _dictionaryDataService;
+ public WmsInStockService(ISqlSugarRepository repository, IDictionaryDataService dictionaryDataService)
{
_db = repository.AsSugarClient();
+ _dictionaryDataService = dictionaryDataService;
}
///
/// 根据入库申请单ID获取申请单明细信息
@@ -29,7 +32,10 @@ namespace Tnb.WarehouseMgr
[HttpGet]
public async Task GetInStockDetailsListById([FromRoute] string billId)
{
+ var dic = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_INSTOCK_D_BILL_STATUS_TYPEID);
var items = await _db.Queryable().Where(it => it.bill_id == billId).ToListAsync();
+ _db.ThenMapper(items,
+ it => it.line_status = dic.ContainsKey(it.line_status) ? dic[it.line_status]?.ToString()! : "");
return items;
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs
new file mode 100644
index 00000000..9cc3b3c3
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using JNPF.Systems.Interfaces.System;
+using Microsoft.AspNetCore.Mvc;
+using SqlSugar;
+using Tnb.WarehouseMgr.Entities;
+using Tnb.WarehouseMgr.Entities.Consts;
+using Tnb.WarehouseMgr.Interfaces;
+
+namespace Tnb.WarehouseMgr
+{
+ ///
+ /// 出库申请业务类
+ ///
+ public class WmsOutStockService : BaseWareHouseService, IWmsOutStockService
+ {
+ private readonly ISqlSugarClient _db;
+ private readonly IDictionaryDataService _dictionaryDataService;
+ public WmsOutStockService(ISqlSugarRepository repository, IDictionaryDataService dictionaryDataService)
+ {
+ _db = repository.AsSugarClient();
+ _dictionaryDataService = dictionaryDataService;
+ }
+
+ ///
+ /// 根据出库申请单ID获取申请单明细信息
+ ///
+ ///
+ ///
+ [HttpGet]
+ public async Task GetInStockDetailsListById([FromRoute] string billId)
+ {
+ var dic = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_INSTOCK_D_BILL_STATUS_TYPEID);
+ var items = await _db.Queryable().Where(it => it.bill_id == billId).ToListAsync();
+ _db.ThenMapper(items,
+ it => it.line_status = dic.ContainsKey(it.line_status) ? dic[it.line_status]?.ToString()! : "");
+ return items;
+ }
+ }
+}
diff --git a/system/Tnb.Systems.Interfaces/System/IDictionaryDataService.cs b/system/Tnb.Systems.Interfaces/System/IDictionaryDataService.cs
index 851291dc..d166c8dc 100644
--- a/system/Tnb.Systems.Interfaces/System/IDictionaryDataService.cs
+++ b/system/Tnb.Systems.Interfaces/System/IDictionaryDataService.cs
@@ -38,4 +38,10 @@ public interface IDictionaryDataService
///
///
Task> GetDicByTypeId(string typeId);
+ ///
+ /// 根据typeId获取字典
+ ///
+ ///
+ /// {{id,fullName}}
+ Task> GetDictionaryByTypeId(string typeId);
}
\ No newline at end of file
diff --git a/system/Tnb.Systems/System/DictionaryDataService.cs b/system/Tnb.Systems/System/DictionaryDataService.cs
index 6840545f..3a42488d 100644
--- a/system/Tnb.Systems/System/DictionaryDataService.cs
+++ b/system/Tnb.Systems/System/DictionaryDataService.cs
@@ -345,7 +345,8 @@ public class DictionaryDataService : IDictionaryDataService, IDynamicApiControll
public async Task> GetDicByTypeId(string typeId) =>
await _repository.AsQueryable().Where(x => x.DictionaryTypeId == typeId && x.DeleteMark == null).ToDictionaryAsync(x => x.EnCode, x => x.FullName);
-
+ public async Task> GetDictionaryByTypeId(string typeId) =>
+ await _repository.AsQueryable().Where(x => x.DictionaryTypeId == typeId && x.DeleteMark == null).ToDictionaryAsync(x => x.Id, x => x.FullName);
#endregion