diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasMaterialInboundWh.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasMaterialInboundWh.cs
new file mode 100644
index 00000000..5e447404
--- /dev/null
+++ b/BasicData/Tnb.BasicData.Entities/Entity/BasMaterialInboundWh.cs
@@ -0,0 +1,42 @@
+using JNPF.Common.Contracts;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.BasicData.Entities;
+
+///
+/// 物料入库仓库
+///
+[SugarTable("bas_material_inbound_wh")]
+public partial class BasMaterialInboundWh : BaseEntity
+{
+ public BasMaterialInboundWh()
+ {
+ id = SnowflakeIdHelper.NextId();
+ }
+ ///
+ /// 物料id
+ ///
+ public string? material_id { get; set; }
+
+ ///
+ /// 仓库id
+ ///
+ public string? wh_id { get; set; }
+
+ ///
+ /// 最大库存
+ ///
+ public int? max_stock { get; set; }
+
+ ///
+ /// 最小库存
+ ///
+ public int? min_stock { get; set; }
+
+ ///
+ /// 安全库存
+ ///
+ public int? safe_stock { get; set; }
+
+}
diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasMaterialSendWarehouse.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasMaterialSendWarehouse.cs
new file mode 100644
index 00000000..ac2eaca3
--- /dev/null
+++ b/BasicData/Tnb.BasicData.Entities/Entity/BasMaterialSendWarehouse.cs
@@ -0,0 +1,42 @@
+using JNPF.Common.Contracts;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.BasicData.Entities;
+
+///
+/// 物料发料仓库
+///
+[SugarTable("bas_material_send_warehouse")]
+public partial class BasMaterialSendWarehouse : BaseEntity
+{
+ public BasMaterialSendWarehouse()
+ {
+ id = SnowflakeIdHelper.NextId();
+ }
+ ///
+ /// 物料id
+ ///
+ public string? material_id { get; set; }
+
+ ///
+ /// 仓库id
+ ///
+ public string? wh_id { get; set; }
+
+ ///
+ /// 最大库存
+ ///
+ public int? max_stock { get; set; }
+
+ ///
+ /// 最小库存
+ ///
+ public int? min_stock { get; set; }
+
+ ///
+ /// 安全库存
+ ///
+ public int? safe_stock { get; set; }
+
+}
diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs
index a451bb01..cbe7eed4 100644
--- a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs
+++ b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs
@@ -6,6 +6,22 @@ using System.Threading.Tasks;
namespace Tnb.QcMgr.Entities.Dto
{
+ public class QcCheckExecHOut
+ {
+ public string? id { get; set; }
+ public string? materialid { get; set; }
+ public string? checktype { get; set; }
+ public string? workid { get; set; }
+ public string? processid { get; set; }
+ public string? wareid { get; set; }
+ public string? checknum { get; set; }
+ public string? status { get; set; }
+ public string? result { get; set; }
+ public string? tasktime { get; set; }
+ public string? exectime { get; set; }
+ public string? execuser { get; set; }
+
+ }
public class CheckTaskOut
{
public string? mainid { get; set; }
diff --git a/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs b/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs
new file mode 100644
index 00000000..21c4a099
--- /dev/null
+++ b/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Aspose.Cells.Drawing;
+using JNPF.Common.Core.Manager;
+using JNPF.Common.Filter;
+using JNPF.DependencyInjection;
+using JNPF.DynamicApiController;
+using JNPF.Systems.Entitys.Permission;
+using JNPF.Systems.Entitys.System;
+using JNPF.VisualDev;
+using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
+using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json;
+using SqlSugar;
+using Tnb.BasicData.Entities;
+using Tnb.QcMgr.Entities;
+using Tnb.QcMgr.Entities.Dto;
+
+namespace Tnb.QcMgr
+{ ///
+ /// 质检任务模块
+ ///
+ [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 800)]
+ [Route("api/[area]/[controller]/[action]")]
+ [OverideVisualDev(ModuleId)]
+ public class QcCheckTaskResultServic:IDynamicApiController, ITransient, IOverideVisualDevService
+ {
+ private const string ModuleId = "26873741070613";
+ private readonly ISqlSugarRepository _repository;
+ private readonly IUserManager _userManager;
+ public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
+ public QcCheckTaskResultServic(ISqlSugarRepository repository, IUserManager userManager)
+ {
+ _repository = repository;
+ _userManager = userManager;
+ OverideFuncs.GetListAsync = GetListAsync;
+ }
+ private async Task GetListAsync(VisualDevModelListQueryInput input)
+ {
+ var db = _repository.AsSugarClient();
+ Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary();
+ string materialid = queryJson.ContainsKey("materialid") ? queryJson["materialid"].ToString() : "";
+ string checktype = queryJson.ContainsKey("checktype") ? queryJson["checktype"].ToString() : "";
+ string status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : "";
+ var list = await db.Queryable()
+ .LeftJoin((a, b) => a.DictionaryTypeId == b.Id)
+ .Where((a, b) => b.FullName == "质检状态" || b.FullName == "质检类型选择").ToListAsync();
+ var result = await db.Queryable()
+ .LeftJoin((a, b) => a.materialid == b.id)
+ .LeftJoin((a, b, c) => a.processid == c.id)
+ .LeftJoin((a, b, c, d) => a.workid == d.Id)
+ .LeftJoin((a, b, c, d, e) => a.execuser == e.Id)
+ .WhereIF(!string.IsNullOrEmpty(materialid), (a, b, c, d, e) => a.materialid == materialid)
+ .WhereIF(!string.IsNullOrEmpty(checktype), (a, b, c, d, e) => a.checktype == checktype)
+ .WhereIF(!string.IsNullOrEmpty(status), (a, b, c, d, e) => a.status == status)
+ .Where((a, b, c, d, e) => a.status == list.Where(p => p.FullName == "已完成").First().Id)
+ .Select((a, b, c, d, e) => new QcCheckExecHOut
+ {
+ id = a.id,
+ materialid = b.name,
+ checktype = a.checktype,
+ workid = d.FullName,
+ processid = c.process_name,
+ wareid = a.wareid,
+ checknum = a.checknum,
+ status = a.status,
+ result = a.result,
+ tasktime = a.tasktime == null ? "" : a.tasktime,
+ exectime = a.exectime == null ? "" : a.exectime,
+ execuser = e.RealName == null ? "" : e.RealName,
+ }).OrderByDescending(a => a.tasktime).ToPagedListAsync(input.currentPage, input.pageSize);
+ foreach (var item in result.list)
+ {
+ item.checktype = list.Select(p => p.Id).Contains(item.checktype) ? list.Where(p => p.Id == item.checktype).First().FullName : "";
+ item.status = list.Select(p => p.Id).Contains(item.status) ? list.Where(p => p.Id == item.status).First().FullName : "";
+ }
+ return PageResult.SqlSugarPageResult(result);
+ }
+ }
+}
diff --git a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs
index d18ec401..7d57caca 100644
--- a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs
+++ b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs
@@ -1,11 +1,13 @@
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.Common.Core.Manager;
using JNPF.Common.Enums;
+using JNPF.Common.Filter;
using JNPF.Common.Security;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
@@ -13,13 +15,22 @@ using JNPF.FriendlyException;
using JNPF.JsonSerialization;
using JNPF.Systems.Entitys.Permission;
using JNPF.Systems.Entitys.System;
+using JNPF.VisualDev;
+using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json;
using SqlSugar;
+using Tnb.BasicData.Entities;
+using Tnb.BasicData;
+using Tnb.EquipMgr.Entities;
+using Tnb.ProductionMgr.Entities.Dto;
+using Tnb.ProductionMgr.Entities;
using Tnb.QcMgr.Entities;
using Tnb.QcMgr.Entities.Dto;
using Tnb.QcMgr.Entities.Entity;
using Tnb.QcMgr.Interfaces;
+using JNPF.Common.Extension;
namespace Tnb.QcMgr
{
@@ -28,14 +39,60 @@ namespace Tnb.QcMgr
///
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 800)]
[Route("api/[area]/[controller]/[action]")]
- public class QcCheckTaskService : IQcCheckTaskService, IDynamicApiController, ITransient
+ [OverideVisualDev(ModuleId)]
+ public class QcCheckTaskService : IQcCheckTaskService, IDynamicApiController, ITransient, IOverideVisualDevService
{
+ private const string ModuleId = "26745613138709";
private readonly ISqlSugarRepository _repository;
private readonly IUserManager _userManager;
+ public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
public QcCheckTaskService(ISqlSugarRepository repository, IUserManager userManager)
{
_repository = repository;
_userManager = userManager;
+ OverideFuncs.GetListAsync = GetListAsync;
+ }
+
+ private async Task GetListAsync(VisualDevModelListQueryInput input)
+ {
+ var db = _repository.AsSugarClient();
+ Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary();
+ string materialid = queryJson.ContainsKey("materialid") ? queryJson["materialid"].ToString() : "";
+ string checktype = queryJson.ContainsKey("checktype") ? queryJson["checktype"].ToString() : "";
+ string status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : "";
+ var list = await db.Queryable()
+ .LeftJoin((a, b) => a.DictionaryTypeId == b.Id)
+ .Where((a, b) => b.FullName == "质检状态" || b.FullName == "质检类型选择").ToListAsync();
+ var result = await db.Queryable()
+ .LeftJoin((a, b) => a.materialid == b.id)
+ .LeftJoin((a, b, c) => a.processid == c.id)
+ .LeftJoin((a, b, c, d) => a.workid == d.Id)
+ .LeftJoin((a, b, c, d, e) => a.execuser == e.Id)
+ .WhereIF(!string.IsNullOrEmpty(materialid), (a, b, c, d, e) => a.materialid == materialid)
+ .WhereIF(!string.IsNullOrEmpty(checktype), (a, b, c, d, e) => a.checktype == checktype)
+ .WhereIF(!string.IsNullOrEmpty(status), (a, b, c, d, e) => a.status == status)
+ .Where((a,b,c,d,e)=>a.status== list.Where(p=>p.FullName=="待执行").First().Id)
+ .Select((a, b, c, d, e) => new QcCheckExecHOut
+ {
+ id = a.id,
+ materialid = b.name,
+ checktype = a.checktype,
+ workid = d.FullName,
+ processid = c.process_name,
+ wareid = a.wareid,
+ checknum = a.checknum,
+ status = a.status,
+ result = a.result,
+ tasktime = a.tasktime == null ? "" : a.tasktime,
+ exectime = a.exectime == null ? "" : a.exectime,
+ execuser = e.RealName == null ? "" : e.RealName,
+ }).OrderByDescending(a => a.tasktime).ToPagedListAsync(input.currentPage, input.pageSize);
+ foreach (var item in result.list)
+ {
+ item.checktype = list.Select(p => p.Id).Contains(item.checktype) ? list.Where(p => p.Id == item.checktype).First().FullName : "";
+ item.status = list.Select(p => p.Id).Contains(item.status) ? list.Where(p => p.Id == item.status).First().FullName : "";
+ }
+ return PageResult.SqlSugarPageResult(result);
}
///
/// 获取任务执行明细
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs
index 82c65e85..921904e4 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ModuleConsts.cs
@@ -156,5 +156,9 @@ public class ModuleConsts
/// 模块标识-盘点任务
///
public const string MODULE_WMSCHECKTASK_ID = "27582377555221";
+ ///
+ /// 模块标识-库存报表
+ ///
+ public const string MODULE_WMSSTOCKREPORT_ID = "27895417124373";
}
\ No newline at end of file
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockD.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockD.part.cs
index 296b48e7..57477412 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockD.part.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockD.part.cs
@@ -8,7 +8,7 @@ namespace Tnb.WarehouseMgr.Entities;
/// 入库申请明细表
///
-public partial class WmsInstockD : BaseEntity
+public partial class WmsInstockD
{
///
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsStockReportCode.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsStockReportCode.cs
new file mode 100644
index 00000000..28376aa5
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsStockReportCode.cs
@@ -0,0 +1,87 @@
+using JNPF.Common.Contracts;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.WarehouseMgr.Entities;
+
+///
+/// 库存报表条码表
+///
+[SugarTable("wms_stock_report_code")]
+public partial class WmsStockReportCode : BaseEntity
+{
+ public WmsStockReportCode()
+ {
+ id = SnowflakeIdHelper.NextId();
+ }
+ ///
+ /// 主表ID
+ ///
+ public string? report_id { get; set; }
+
+ ///
+ /// 载具ID
+ ///
+ public string? carry_id { get; set; }
+
+ ///
+ /// 载具编号
+ ///
+ public string? carry_code { get; set; }
+
+ ///
+ /// 物料ID
+ ///
+ public string? material_id { get; set; }
+
+ ///
+ /// 物料编号
+ ///
+ public string? material_code { get; set; }
+
+ ///
+ /// 条码编号
+ ///
+ public string? barcode { get; set; }
+
+ ///
+ /// 批次
+ ///
+ public string? code_batch { get; set; }
+
+ ///
+ /// 条码数量
+ ///
+ public decimal? codeqty { get; set; }
+
+ ///
+ /// 单位ID
+ ///
+ public string? unit_id { get; set; }
+
+ ///
+ /// 创建用户
+ ///
+ public string? create_id { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime? create_time { get; set; }
+
+ ///
+ /// 修改用户
+ ///
+ public string? modify_id { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public DateTime? modify_time { get; set; }
+
+ ///
+ /// 时间戳
+ ///
+ public DateTime? time_stamp { get; set; }
+
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsStockReportH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsStockReportH.cs
new file mode 100644
index 00000000..683f1780
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsStockReportH.cs
@@ -0,0 +1,113 @@
+using JNPF.Common.Contracts;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.WarehouseMgr.Entities;
+
+///
+/// 库存报表
+///
+[SugarTable("wms_stock_report_h")]
+public partial class WmsStockReportH : BaseEntity
+{
+ public WmsStockReportH()
+ {
+ id = SnowflakeIdHelper.NextId();
+ }
+ ///
+ /// 所属组织
+ ///
+ public string? org_id { get; set; }
+
+ ///
+ /// 物料ID
+ ///
+ public string? material_id { get; set; }
+
+ ///
+ /// 物料编号
+ ///
+ public string? material_code { get; set; }
+
+ ///
+ /// 仓库ID
+ ///
+ public string? warehouse_id { get; set; }
+
+ ///
+ /// 现有库存
+ ///
+ public decimal? existing_stock_qty { get; set; }
+
+ ///
+ /// 最大库存
+ ///
+ public int? max_stock { get; set; }
+
+ ///
+ /// 安全库存
+ ///
+ public int? safe_stock { get; set; }
+
+ ///
+ /// 最小库存
+ ///
+ public int? min_stock { get; set; }
+
+ ///
+ /// 库存有效期(天)
+ ///
+ public int? storage_valid_day { get; set; }
+
+ ///
+ /// 预警提前期(天)
+ ///
+ public int? early_warn_day { get; set; }
+
+ ///
+ /// 过期预警数量
+ ///
+ public decimal? expired_warning_qty { get; set; }
+
+ ///
+ /// 创建用户
+ ///
+ public string? create_id { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime? create_time { get; set; }
+
+ ///
+ /// 修改用户
+ ///
+ public string? modify_id { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public DateTime? modify_time { get; set; }
+
+ ///
+ /// 扩展
+ ///
+ public string? extras { get; set; }
+
+ ///
+ /// 时间戳
+ ///
+ public DateTime? timestamp { get; set; }
+
+ ///
+ /// 流程任务Id
+ ///
+ public string? f_flowtaskid { get; set; }
+
+ ///
+ /// 流程引擎Id
+ ///
+ public string? f_flowid { get; set; }
+
+}
+
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsStockReportH.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsStockReportH.part.cs
new file mode 100644
index 00000000..fef9ccbb
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsStockReportH.part.cs
@@ -0,0 +1,26 @@
+using JNPF.Common.Contracts;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.WarehouseMgr.Entities;
+
+///
+/// 库存报表
+///
+public partial class WmsStockReportH
+{
+ ///
+ /// 物料名称
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public string mater_name { get; set; }
+ ///
+ /// 明细列表
+ ///
+ [SugarColumn(IsIgnore =true)]
+ public List Details { get; set; }
+ [SugarColumn(IsIgnore = true)]
+ public decimal codeqty { get; set; }
+
+}
+
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs
index 9fdd5303..f51c99cb 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs
@@ -3,13 +3,16 @@ using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
+using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
using Aspose.Cells.Drawing;
using JNPF;
using JNPF.Common.Contracts;
+using JNPF.Common.Core.Manager;
using JNPF.Common.Enums;
using JNPF.Common.Extension;
+using JNPF.DataEncryption;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.Systems.Interfaces.System;
@@ -49,6 +52,19 @@ namespace Tnb.WarehouseMgr
}
}
}
+
+ protected Task GetUserIdentity(string aToken)
+ {
+ var claims = JWTEncryption.ReadJwtToken(aToken)?.Claims;
+ ClaimsIdentity toKen = new ClaimsIdentity();
+ foreach (Claim item in claims)
+ {
+ toKen.AddClaim(item);
+ }
+ var curUser = new ClaimsPrincipal(toKen);
+ return Task.FromResult(curUser);
+ }
+
///
/// 判断最终目标库位是否可以放置当前载具
///
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/ConditionalBackgroundService.cs b/WarehouseMgr/Tnb.WarehouseMgr/ConditionalBackgroundService.cs
new file mode 100644
index 00000000..745a3cf2
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr/ConditionalBackgroundService.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Extensions.Hosting;
+
+namespace Tnb.WarehouseMgr
+{
+ public class ConditionalBackgroundService : IHostedService
+ {
+ private readonly IHostedService _backgroundService;
+ //private readonly Func _condition;
+
+ public ConditionalBackgroundService(IHostedService backgroundService)
+ {
+ _backgroundService = backgroundService;
+ }
+
+ public async Task StartAsync(CancellationToken cancellationToken)
+ {
+ await _backgroundService.StartAsync(cancellationToken);
+ }
+ public async Task StopAsync(CancellationToken cancellationToken)
+ {
+ await _backgroundService.StopAsync(cancellationToken);
+ }
+
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/TimedTaskBackgroundService.cs b/WarehouseMgr/Tnb.WarehouseMgr/TimedTaskBackgroundService.cs
index 3f3b38f1..ca071cb4 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/TimedTaskBackgroundService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/TimedTaskBackgroundService.cs
@@ -25,31 +25,30 @@ namespace Tnb.WarehouseMgr
public class TimedTaskBackgroundService : BackgroundService
{
private ISendMessageService? _sendService;
- protected override async Task ExecuteAsync(CancellationToken stoppingToken)
+
+ protected override Task ExecuteAsync(CancellationToken stoppingToken)
{
-
- await Task.Run(() =>
- {
- _sendService = App.GetRequiredService();
- var userManager = App.GetRequiredService();
- List toUserIds = new List() { "25398501929509" };
- //生成任务执行
- CancellationTokenSource genTaskCTS = new();
- CancellationTokenSource kittingOutAddCts = new();
- CancellationTokenSource kittingOutShippedCts = new();
- CancellationTokenSource setSortingCts = new();
+ return Task.Run(() =>
+ {
+ //_sendService = App.GetRequiredService();
+ List toUserIds = new List() { "25398501929509" };
+ //生成任务执行
+ CancellationTokenSource genTaskCTS = new();
+ CancellationTokenSource kittingOutAddCts = new();
+ CancellationTokenSource kittingOutShippedCts = new();
+ CancellationTokenSource setSortingCts = new();
- var wareHouseService = App.GetRequiredService();
- TimedTask(cts => wareHouseService.GenTaskExecute(cts), genTaskCTS, toUserIds);
- //齐套出库
+ var wareHouseService = App.GetRequiredService();
+ TimedTask(cts => wareHouseService.GenTaskExecute(cts), genTaskCTS, toUserIds);
+ //齐套出库
- var kittingOutService = App.GetRequiredService();
- TimedTask(cts => kittingOutService.KittingOutByAdd(cts), kittingOutAddCts, toUserIds);
- TimedTask(cts => kittingOutService.KittingOutByIsToBeShipped(cts), kittingOutShippedCts, toUserIds);
- //齐套分拣
- var setSortingService = App.GetRequiredService();
- TimedTask(cts => setSortingService.PackSortingByAdd(cts), setSortingCts, toUserIds);
- });
+ var kittingOutService = App.GetRequiredService();
+ TimedTask(cts => kittingOutService.KittingOutByAdd(cts), kittingOutAddCts, toUserIds);
+ TimedTask(cts => kittingOutService.KittingOutByIsToBeShipped(cts), kittingOutShippedCts, toUserIds);
+ //齐套分拣
+ var setSortingService = App.GetRequiredService();
+ TimedTask(cts => setSortingService.PackSortingByAdd(cts), setSortingCts, toUserIds);
+ });
}
private Task TimedTask(Func action, CancellationTokenSource cts, List? toUserIds = default)
{
@@ -60,9 +59,7 @@ namespace Tnb.WarehouseMgr
{
await action(cts).Catch(ex =>
{
- //MessageSendModel messageSendModel = new();
- //_sendService?.SendMessage();
- //messageService.SentMessage(toUserIds!, ex.Message, ex.ToString());
+ //notify operator
});
await Task.Delay(1000);
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
index 78fabc26..e3a1ca22 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
@@ -217,7 +217,7 @@ namespace Tnb.WarehouseMgr
[HttpPost]
public async Task GenTaskExecute(CancellationTokenSource? cts = default)
{
-
+
Stopwatch sw = Stopwatch.StartNew();
var db = _db.CopyNew();
try
@@ -283,7 +283,6 @@ namespace Tnb.WarehouseMgr
start = end;
end = Math.Min((end + moveNum), arrary.Length);
}
-
foreach (var arr in arrList)
{
for (int j = 1, len = arr.Length; j <= len; j++)
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs
index c171d8a9..dc23aa1b 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs
@@ -449,6 +449,7 @@ namespace Tnb.WarehouseMgr
x.id = SnowflakeIdHelper.NextId();
x.is_out = 0;
x.carry_id = instock!.carry_id!;
+ x.warehouse_id = instock!.warehouse_id!;
});
await _db.Insertable(carryCodes).ExecuteCommandAsync();
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs
index e513798d..ef3d8398 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs
@@ -187,6 +187,7 @@ namespace Tnb.WarehouseMgr
x.carry_id = input.data[nameof(WmsHandleH.carry_id)].ToString()!;
x.create_id = _userManager.UserId;
x.create_time = DateTime.Now;
+ x.warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!;
});
await _db.Insertable(carryCodes).ExecuteCommandAsync();
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs
index 3b594c4d..f56a4a8f 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs
@@ -219,6 +219,7 @@ namespace Tnb.WarehouseMgr
x.id = SnowflakeIdHelper.NextId();
x.is_out = 0;
x.carry_id = input.data[nameof(WmsCarryCode.carry_id)]?.ToString()!;
+ x.warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString();
});
//生成入库申请条码
var instockDetails = await _db.Queryable()
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs
index 53a612da..eb14d720 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs
@@ -99,8 +99,8 @@ namespace Tnb.WarehouseMgr
visualDevModelCrInput.data[nameof(WmsKittingInstock.create_time)] = DateTime.Now;
visualDevModelCrInput.data[nameof(WmsKittingInstock.location_id)] = carry!.location_id!;
visualDevModelCrInput.data[nameof(WmsKittingInstock.bill_code)] = _billRullService.GetBillNumber("WmsKittingInStk").GetAwaiter().GetResult();
- visualDevModelCrInput.data[nameof(WmsKittingInstock.source_id)] = kittingout.source_id;
- visualDevModelCrInput.data[nameof(WmsKittingInstock.source_code)] = kittingout.source_code;
+ visualDevModelCrInput.data[nameof(WmsKittingInstock.source_id)] = kittingout.id;
+ visualDevModelCrInput.data[nameof(WmsKittingInstock.source_code)] = kittingout.bill_code;
var location = await _db.Queryable().SingleAsync(it => it.id == kittingout.location_id);
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs
new file mode 100644
index 00000000..bf83ccf9
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs
@@ -0,0 +1,90 @@
+using System;
+using System.Collections.Generic;
+using System.Dynamic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using JNPF.Common.Core.Manager;
+using JNPF.Common.Security;
+using JNPF.VisualDev;
+using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
+using Mapster;
+using MimeKit.Cryptography;
+using SqlSugar;
+using Tnb.BasicData.Entities;
+using Tnb.WarehouseMgr.Entities;
+using Tnb.WarehouseMgr.Entities.Enums;
+
+namespace Tnb.WarehouseMgr
+{
+ ///
+ /// 库存报表服务类
+ ///
+ [OverideVisualDev(ModuleConsts.MODULE_WMSSTOCKREPORT_ID)]
+ public class WmsStockReportService : BaseWareHouseService
+ {
+ private readonly ISqlSugarClient _db;
+ private readonly IUserManager _userManager;
+
+ public WmsStockReportService(ISqlSugarRepository repository, IUserManager userManager)
+ {
+ _db = repository.AsSugarClient();
+ _userManager = userManager;
+ OverideFuncs.GetListAsync = GetListAsync;
+ }
+
+ private async Task GetListAsync(VisualDevModelListQueryInput input)
+ {
+ var items = await _db.Queryable().InnerJoin((a, b) => a.material_id == b.id)
+ .InnerJoin((a, b, c) => b.id == c.material_id)
+ .InnerJoin((a, b, c, d) => a.carry_id == d.id)
+ .InnerJoin((a, b, c, d, e) => d.location_id == e.id)
+ .Where((a, b, c, d, e) => e.is_type == ((int)EnumLocationType.存储库位).ToString())
+ .Select((a, b, c, d, e) => new WmsStockReportH
+ {
+ warehouse_id = a.warehouse_id,
+ mater_name = b.name,
+ create_time = a.create_time,
+ create_id = a.create_id,
+ }, true)
+ .ToListAsync();
+ var carryCodes = await _db.Queryable().ToListAsync();
+ var result = items.GroupBy(g => new { g.warehouse_id, g.material_id }).Select(itGroup =>
+ {
+ WmsStockReportH stockReport = new();
+ stockReport.material_code = items.Find(x => x.warehouse_id == itGroup.Key.warehouse_id && x.material_id == itGroup.Key.material_id)?.material_code;
+ stockReport.mater_name = items.Find(x => x.warehouse_id == itGroup.Key.warehouse_id && x.material_id == itGroup.Key.material_id)?.mater_name ?? string.Empty;
+ stockReport.existing_stock_qty = itGroup.Sum(d => d.codeqty);
+ stockReport.max_stock = items.Find(t => t.warehouse_id == itGroup.Key.warehouse_id && t.material_id == itGroup.Key.material_id)?.max_stock;
+ stockReport.safe_stock = items.Find(t => t.warehouse_id == itGroup.Key.warehouse_id && t.material_id == itGroup.Key.material_id)?.safe_stock;
+ stockReport.min_stock = items.Find(t => t.warehouse_id == itGroup.Key.warehouse_id && t.material_id == itGroup.Key.material_id)?.min_stock;
+ stockReport.min_stock = items.Find(t => t.warehouse_id == itGroup.Key.warehouse_id && t.material_id == itGroup.Key.material_id)?.min_stock;
+ stockReport.storage_valid_day = items.Find(t => t.material_id == itGroup.Key.material_id)?.storage_valid_day;
+ stockReport.early_warn_day = items.Find(t => t.material_id == itGroup.Key.material_id)?.early_warn_day;
+ stockReport.create_id = _userManager.UserId;
+ stockReport.create_time = DateTime.Now;
+ if (stockReport.storage_valid_day.HasValue)
+ {
+ decimal expired_warning_qty = 0;
+ foreach (var item in itGroup)
+ {
+ if (DateTime.Now.Subtract(item.create_time.Value).TotalDays >= (item.storage_valid_day - item.early_warn_day))
+ {
+ expired_warning_qty += item.codeqty;
+ }
+ }
+ stockReport.expired_warning_qty = expired_warning_qty;
+ }
+ var curCarryCodes = carryCodes.FindAll(x => x.warehouse_id == itGroup.Key.warehouse_id && x.material_id == itGroup.Key.material_id);
+ stockReport.Details = curCarryCodes.Adapt>();
+ stockReport.Details.ForEach(x =>
+ {
+ x.id = SnowflakeIdHelper.NextId();
+ x.report_id = stockReport.id;
+ });
+ return stockReport;
+ });
+ return result;
+ }
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs
index adbee72a..0f6c0518 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs
@@ -4,18 +4,25 @@ using System.Data;
using System.Data.Common;
using System.Linq;
using System.Linq.Expressions;
+using System.Net.Http;
+using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
using System.Transactions;
using Aop.Api.Domain;
+using JNPF;
+using JNPF.Common.Const;
using JNPF.Common.Core.Manager;
using JNPF.Common.Dtos.VisualDev;
using JNPF.Common.Enums;
using JNPF.Common.Extension;
+using JNPF.Common.Manager;
using JNPF.Common.Security;
+using JNPF.DataEncryption;
using JNPF.FriendlyException;
using JNPF.LinqBuilder;
using JNPF.Logging;
+using JNPF.Systems.Entitys.Permission;
using JNPF.Systems.Interfaces.System;
using Mapster;
using Microsoft.AspNetCore.Http;
@@ -45,14 +52,23 @@ namespace Tnb.WarehouseMgr
private readonly IUserManager _userManager;
private readonly IBillRullService _billRullService;
private readonly IWmsCarryService _carryService;
+ private readonly ICacheManager _cacheManager;
private const string BizTypeId = "26169472620837";
- public WmskittingOutService(ISqlSugarRepository repository, IWareHouseService warehouseService, IUserManager userManager, IBillRullService billRullService, IWmsCarryService carryService)
+ public WmskittingOutService(
+ ISqlSugarRepository repository,
+ IWareHouseService warehouseService,
+ IUserManager userManager,
+ IBillRullService billRullService,
+ IWmsCarryService carryService,
+ ICacheManager cacheManager
+ )
{
_db = repository.AsSugarClient();
_warehouseService = warehouseService;
_userManager = userManager;
_billRullService = billRullService;
_carryService = carryService;
+ _cacheManager = cacheManager;
}
///
/// 齐套出库(新增状态)
@@ -61,6 +77,10 @@ namespace Tnb.WarehouseMgr
[HttpPost]
public async Task KittingOutByAdd(CancellationTokenSource? cts = default)
{
+ var aToken = await _cacheManager.GetAsync("AsscessToken");
+ if (aToken.IsNullOrWhiteSpace()) return;
+ var curUser = await GetUserIdentity(aToken);
+
var curDb = _db.CopyNew();
try
{
@@ -114,8 +134,8 @@ namespace Tnb.WarehouseMgr
setSortingH.id = SnowflakeIdHelper.NextId();
setSortingH.kittingout_id = ko.id;
setSortingH.seq = ko.seq;
- setSortingH.org_id = _userManager.User.OrganizeId;
- setSortingH.create_id = _userManager.UserId;
+ setSortingH.org_id = curUser.FindFirst(ClaimConst.CLAINMORGID)?.Value;
+ setSortingH.create_id = curUser.FindFirst(ClaimConst.CLAINMUSERID)?.Value!;
setSortingH.create_time = DateTime.Now;
await curDb.Insertable(setSortingH).ExecuteCommandAsync();
@@ -155,6 +175,10 @@ namespace Tnb.WarehouseMgr
[HttpPost]
public async Task KittingOutByIsToBeShipped(CancellationTokenSource? cts = default)
{
+ var aToken = await _cacheManager.GetAsync("AsscessToken");
+ if (aToken.IsNullOrWhiteSpace()) return;
+ var curUser = await GetUserIdentity(aToken);
+
var curDb = _db.CopyNew();
try
{
@@ -193,7 +217,7 @@ namespace Tnb.WarehouseMgr
WmsPretaskH preTask = new()
{
- org_id = _userManager.User.OrganizeId,
+ org_id = curUser.FindFirst(ClaimConst.CLAINMORGID)?.Value,
startlocation_id = sPoint?.location_id!,
startlocation_code = sPoint?.location_code!,
endlocation_id = ePoint?.location_id!,
@@ -214,7 +238,7 @@ namespace Tnb.WarehouseMgr
area_code = it.Key,
require_id = ko.id,
require_code = ko.bill_code,
- create_id = _userManager.UserId,
+ create_id = curUser.FindFirst(ClaimConst.CLAINMUSERID)?.Value!,
create_time = DateTime.Now,
source_id = ko.source_id,
source_code = ko.source_code
@@ -234,14 +258,6 @@ namespace Tnb.WarehouseMgr
}
}
}
- else
- {
- throw new AppFriendlyException("无可用的载具", 500);
- }
- }
- else
- {
- throw new AppFriendlyException("无可用的库位", 500);
}
}
}
diff --git a/apihost/Tnb.API.Entry/Startup.cs b/apihost/Tnb.API.Entry/Startup.cs
index dd5e6ed7..d7748aae 100644
--- a/apihost/Tnb.API.Entry/Startup.cs
+++ b/apihost/Tnb.API.Entry/Startup.cs
@@ -63,9 +63,10 @@ public class Startup : AppStartup
services.AddOverideVisualDev();
+ #if !DEBUG
//定时任务
services.AddHostedService();
-
+ #endif
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider, IOptions senparcSetting, IOptions senparcWeixinSetting)
diff --git a/common/Tnb.Common.Core/Manager/User/UserManager.cs b/common/Tnb.Common.Core/Manager/User/UserManager.cs
index d71c492f..bc1e0a60 100644
--- a/common/Tnb.Common.Core/Manager/User/UserManager.cs
+++ b/common/Tnb.Common.Core/Manager/User/UserManager.cs
@@ -21,7 +21,7 @@ namespace JNPF.Common.Core.Manager;
///
/// 用户管理 .
///
-public class UserManager : IUserManager, IScoped
+public partial class UserManager : IUserManager, IScoped
{
///
/// 用户表仓储.
@@ -76,7 +76,6 @@ public class UserManager : IUserManager, IScoped
public UserEntity User
{
get => _repository.GetSingle(u => u.Id == UserId);
-
}
///
diff --git a/common/Tnb.Common.Core/Manager/User/UserManager.part.cs b/common/Tnb.Common.Core/Manager/User/UserManager.part.cs
new file mode 100644
index 00000000..75597582
--- /dev/null
+++ b/common/Tnb.Common.Core/Manager/User/UserManager.part.cs
@@ -0,0 +1,27 @@
+using JNPF.Common.Const;
+using JNPF.Common.Enums;
+using JNPF.Common.Extension;
+using JNPF.Common.Manager;
+using JNPF.Common.Models.Authorize;
+using JNPF.Common.Models.User;
+using JNPF.Common.Net;
+using JNPF.Common.Security;
+using JNPF.DataEncryption;
+using JNPF.DependencyInjection;
+using JNPF.Systems.Entitys.Entity.Permission;
+using JNPF.Systems.Entitys.Permission;
+using JNPF.Systems.Entitys.System;
+using Mapster;
+using Microsoft.AspNetCore.Http;
+using SqlSugar;
+using System.Security.Claims;
+
+namespace JNPF.Common.Core.Manager;
+
+///
+/// 用户管理 .
+///
+public partial class UserManager
+{
+ public static string AsscessToken { get; set; }
+}
\ No newline at end of file
diff --git a/system/Tnb.OAuth/OAuthService.cs b/system/Tnb.OAuth/OAuthService.cs
index afebf9dd..9c389e8f 100644
--- a/system/Tnb.OAuth/OAuthService.cs
+++ b/system/Tnb.OAuth/OAuthService.cs
@@ -41,6 +41,8 @@ using JNPF.Common.Core.Handlers;
using JNPF.Message.Interfaces.Message;
using JNPF.Extras.DatabaseAccessor.SqlSugar.Models;
using Aop.Api.Domain;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
namespace JNPF.OAuth;
@@ -140,6 +142,8 @@ public class OAuthService : IDynamicApiController, ITransient
private readonly IMHandler _imHandler;
+
+
///
/// 初始化一个类型的新实例.
///
@@ -382,6 +386,8 @@ public class OAuthService : IDynamicApiController, ITransient
[HttpGet("Logout")]
public async Task Logout([FromQuery] string ticket)
{
+ await _cacheManager.DelAsync("AsscessToken");
+
var tenantId = _userManager.TenantId ?? "default";
var userId = _userManager.UserId ?? "admim";
var httpContext = _httpContextAccessor.HttpContext;
@@ -600,6 +606,10 @@ public class OAuthService : IDynamicApiController, ITransient
{ ClaimConst.LOGINTYPE,input.login_type}
}, tokenTimeout);
+ //modify by ly on 20230804
+ UserManager.AsscessToken = accessToken;
+ await _cacheManager.SetAsync("AsscessToken", accessToken,TimeSpan.FromMinutes(30));
+
// 单点登录标识缓存
if (_oauthOptions.Enabled) _cacheManager.Set("OnlineTicket_" + input.online_ticket, options.ConfigId);
@@ -671,7 +681,6 @@ public class OAuthService : IDynamicApiController, ITransient
}
}
}
-
return new
{
theme = user.Theme == null ? "classic" : user.Theme,
diff --git a/taskschedule/Tnb.TaskScheduler/TimeTaskService.cs b/taskschedule/Tnb.TaskScheduler/TimeTaskService.cs
index 41e779a2..9b62e4c1 100644
--- a/taskschedule/Tnb.TaskScheduler/TimeTaskService.cs
+++ b/taskschedule/Tnb.TaskScheduler/TimeTaskService.cs
@@ -302,7 +302,7 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie
// 非多租户模式启动自启任务
if (!KeyVariable.MultiTenancy)
{
- _repository.AsQueryable().Where(x => x.DeleteMark == null && x.EnabledMark == 1).ToList().ForEach(x=>AddTimerJob(x,false));//modifyby zhoukeda 20230607
+ _repository.AsSugarClient().CopyNew().Queryable().Where(x => x.DeleteMark == null && x.EnabledMark == 1).ToList().ForEach(x=>AddTimerJob(x,false));//modifyby zhoukeda 20230607
}
}