diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/ServiceModuleAttribute.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/ServiceModuleAttribute.cs
new file mode 100644
index 00000000..0224145f
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/ServiceModuleAttribute.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.WarehouseMgr.Entities.Attributes
+{
+ ///
+ /// 业务类型模块特性
+ ///
+ [AttributeUsage(AttributeTargets.Class)]
+ public class ServiceModuleAttribute : Attribute
+ {
+ ///
+ /// 业务类型ID
+ ///
+ public string BizTypeId { get; set; }
+ public ServiceModuleAttribute(string bizTypeId)
+ {
+ this.BizTypeId = bizTypeId;
+ }
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs
new file mode 100644
index 00000000..f571d010
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.WarehouseMgr.Entities.Dto
+{
+ ///
+ /// 库房业务更新输入参数
+ ///
+ public class WareHouseUpInput
+ {
+ ///
+ /// 需求来源单据Id,对应业务主表Id
+ ///
+ public string requireId { get; set; }
+ ///
+ /// 单据业务类型Id
+ ///
+ public string bizTypeId { get; set; }
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumWareHouseModule.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumWareHouseModule.cs
new file mode 100644
index 00000000..8c55ebb1
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumWareHouseModule.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.WarehouseMgr.Entities.Enums
+{
+ ///
+ /// 库房模块
+ ///
+ public enum EnumWareHouseModule
+ {
+ ///
+ /// 其它
+ ///
+ other= 1,
+ ///
+ /// 空载具出库
+ ///
+ WmsEptyOutStk=2,
+ ///
+ /// 载具移出
+ ///
+ WmsMoOutstk = 3,
+ ///
+ /// 空载具入库
+ ///
+ WmsEmptyInstock = 4,
+ ///
+ /// 载具移入
+ ///
+ CarryMoveInStock = 5,
+ ///
+ /// 齐套分拣
+ ///
+ WmsTransfer = 6,
+ ///
+ /// 寄存捆包
+ ///
+ WmsInbale = 7,
+ ///
+ /// 一般入库
+ ///
+ WmsInStock = 8,
+ ///
+ /// 一般出库
+ ///
+ WmsOutStock = 9,
+ ///
+ /// 齐套入库
+ ///
+ WmsKittingInStk = 10,
+ ///
+ /// 齐套出库
+ ///
+ WmsKittingOutStk = 11,
+ ///
+ /// 寄存出库
+ ///
+ WmsOutBale = 12,
+ ///
+ /// 寄存入库
+ ///
+ WmsInbaleInStk = 13,
+ ///
+ /// 配送申请
+ ///
+ WmsDelivery = 14,
+ ///
+ /// 异常取消
+ ///
+ WmsExceptionCancel = 15,
+ ///
+ /// 异常重新执行
+ ///
+ WmsExceptionReExcute = 16,
+ ///
+ /// 异常完成
+ ///
+ WmsExceptionComplete = 17,
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/Interface1.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/Interface1.cs
new file mode 100644
index 00000000..ca71435b
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/Interface1.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.WarehouseMgr.Interfaces
+{
+ ///
+ /// 更新业务单据信息接口
+ ///
+ public interface IUpdateBizBillInfo
+ {
+ Task Modify(string requireId);
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs
index 04d0ff8e..767eb5cd 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs
@@ -1,13 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Aspose.Cells.Drawing;
+using JNPF;
+using JNPF.Common.Extension;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.VisualDev;
using Microsoft.AspNetCore.Mvc;
+using Tnb.WarehouseMgr.Entities.Attributes;
+using Tnb.WarehouseMgr.Entities.Dto;
namespace Tnb.WarehouseMgr
{
@@ -15,8 +20,36 @@ namespace Tnb.WarehouseMgr
[Route("api/[area]/[controller]/[action]")]
public class BaseWareHouseService : IOverideVisualDevService, IDynamicApiController, ITransient
{
+ private static Dictionary _serviceMap = new Dictionary();
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
-
+ static BaseWareHouseService()
+ {
+ var serviceTypes = App.EffectiveTypes.Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && u.IsSubclassOf(typeof(BaseWareHouseService))).ToList();
+ foreach (var serviceType in serviceTypes)
+ {
+ var bizTypeId = serviceType.GetCustomAttribute()?.BizTypeId;
+ if (!bizTypeId.IsNullOrEmpty())
+ {
+ _serviceMap[bizTypeId!] = (BaseWareHouseService)Activator.CreateInstance(serviceType)!;
+ }
+ }
+ }
+
+ protected Task this[WareHouseUpInput input]
+ {
+ set
+ {
+ if (_serviceMap.ContainsKey(input.bizTypeId))
+ {
+ _serviceMap[input.bizTypeId].ModifyAsync(input);
+ }
+ }
+ }
+
+ public virtual Task ModifyAsync(WareHouseUpInput input)
+ {
+ return Task.CompletedTask;
+ }
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
index 2ebf940f..ef64d08a 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
@@ -393,14 +393,35 @@ namespace Tnb.WarehouseMgr
//更新任务执行表,单据状态为 完成
await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync();
//更新预任务申请表,单据状态为 已完成
- var preTaskIds = await _db.Queryable().Where(it => input.disTaskIds.Contains(it.id)).Select(it => it.pretask_id).ToListAsync();
- if(preTaskIds?.Count > 0)
+ var disTasks = await _db.Queryable().Where(it => input.disTaskIds.Contains(it.id)).ToListAsync();
+ if (disTasks?.Count > 0)
{
+ var preTaskIds = disTasks.Select(x => x.pretask_id).ToList();
await _db.Updateable().SetColumns(it => new WmsPretaskH { status = WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID }).Where(it => preTaskIds.Contains(it.id)).ExecuteCommandAsync();
}
//更新载具,锁定状态为未锁定,更新载具的库位当前任务的目标库位
+ if (disTasks?.Count > 0)
+ {
+ var multiList = disTasks.Select(it => (it.carry_id, it.endlocation_id)).ToList();
+ for (int i = 0; i < multiList.Count; i++)
+ {
+ await _db.Updateable().SetColumns(it => new WmsCarryH { is_lock = 0, location_id = multiList[i].endlocation_id }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync();
+ }
+ }
//更新库位信息,使用状态为 使用,锁定状态为未锁定
+ if (disTasks?.Count > 0)
+ {
+ var destLocIds = disTasks.Select(it => it.endlocation_id).ToList();
+ await _db.Updateable().SetColumns(it => new BasLocation { is_use = "1", is_lock = 0 }).Where(it => destLocIds.Contains(it.id)).ExecuteCommandAsync();
+ }
//更新业务主表的单据状态
+ if (disTasks?.Count > 0)
+ {
+ foreach (var dt in disTasks)
+ {
+
+ }
+ }
}
///
@@ -456,7 +477,6 @@ namespace Tnb.WarehouseMgr
#region PrivateMethods
- private bool isArrivedEpoint = false;
private async Task> LocPathCalcAlgorithms(string pStartId, string pEndId, List roads)
{
var points = await _db.Queryable().ToListAsync();
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs
index 105a102e..21ba5738 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs
@@ -18,6 +18,7 @@ using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Tnb.BasicData.Entities;
using Tnb.WarehouseMgr.Entities;
+using Tnb.WarehouseMgr.Entities.Attributes;
using Tnb.WarehouseMgr.Entities.Consts;
using Tnb.WarehouseMgr.Entities.Dto;
using Tnb.WarehouseMgr.Interfaces;
@@ -28,8 +29,10 @@ namespace Tnb.WarehouseMgr
/// 载具移入
///
[OverideVisualDev(ModuleId)]
+ [ServiceModule(BizTypeId)]
public class WmsCarryMoveInStockService : BaseWareHouseService
{
+ private const string BizTypeId = "26121988909861";
private const string ModuleId = "26122102481957";
private readonly ISqlSugarClient _db;
private readonly IRunService _runService;
@@ -137,5 +140,12 @@ namespace Tnb.WarehouseMgr
}
return Task.FromResult(true);
}
+
+ public override async Task ModifyAsync(WareHouseUpInput input)
+ {
+ if (input == null) throw new ArgumentNullException(nameof(input));
+ var isOk = await _db.Updateable().SetColumns(it => new WmsMoveInstock { status = input.bizTypeId }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
+ if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
+ }
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs
index 7d5ee9db..d86c11ba 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs
@@ -29,6 +29,7 @@ namespace Tnb.WarehouseMgr
/// 空载具入库
///
[OverideVisualDev(ModuleId)]
+ [AttributeUsage(AttributeTargets.Class)]
public class WmsEmptyInstockService : BaseWareHouseService
{
private const string ModuleId = "26120915344165";