Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -48,6 +48,10 @@ public static class DictConst
|
||||
/// 包装工单
|
||||
/// </summary>
|
||||
public const string PrdMoTypeBZ = "25019191681045";
|
||||
/// <summary>
|
||||
/// 物料分类
|
||||
/// </summary>
|
||||
public const string MaterialCatagoryID = "24882163283733";
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
72
BasicData/Tnb.BasicData.Entities/Entity/BasRegionMat.cs
Normal file
72
BasicData/Tnb.BasicData.Entities/Entity/BasRegionMat.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.BasicData.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 区域物料设定
|
||||
/// </summary>
|
||||
[SugarTable("bas_region_mat")]
|
||||
public partial class BasRegionMat : BaseEntity<string>
|
||||
{
|
||||
public BasRegionMat()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 所属组织
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 区域ID
|
||||
/// </summary>
|
||||
public string region_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 区域代码
|
||||
/// </summary>
|
||||
public string region_code { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 物料分类
|
||||
/// </summary>
|
||||
public string material_type { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string create_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime create_time { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 扩展字段
|
||||
/// </summary>
|
||||
public string? extras { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间戳(用于并发控制)
|
||||
/// </summary>
|
||||
public DateTime? timestamp { get; set; }
|
||||
|
||||
}
|
||||
99
BasicData/Tnb.BasicData/BasRegionMatService.cs
Normal file
99
BasicData/Tnb.BasicData/BasRegionMatService.cs
Normal file
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aspose.Cells.Drawing;
|
||||
using DingTalk.Api.Request;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
|
||||
namespace Tnb.BasicData
|
||||
{
|
||||
/// <summary>
|
||||
/// 区域物料设定
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 701)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
[OverideVisualDev(ModuleId)]
|
||||
|
||||
public class BasRegionMatService : IOverideVisualDevService, IDynamicApiController, ITransient
|
||||
{
|
||||
private const string ModuleId = "26187428200229";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IDictionaryDataService _dataDictionaryService;
|
||||
private static Dictionary<string, object> s_materialCategoryMap = new();
|
||||
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
public BasRegionMatService(ISqlSugarRepository<BasRegionMat> repo,
|
||||
IRunService runService, IVisualDevService visualDevService,
|
||||
IDictionaryDataService dataDictionaryService
|
||||
)
|
||||
{
|
||||
_db = repo.AsSugarClient();
|
||||
_runService = runService;
|
||||
_visualDevService = visualDevService;
|
||||
_dataDictionaryService = dataDictionaryService;
|
||||
OverideFuncs.CreateAsync = CreateAsync;
|
||||
}
|
||||
|
||||
private async Task<dynamic> CreateAsync(VisualDevModelDataCrInput input)
|
||||
{
|
||||
Task<int> respTask = Task.FromResult(1);
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
string? regionCode = null, materialType = null;
|
||||
if (input.data.ContainsKey(nameof(BasRegionMat.region_code)) && input.data[nameof(BasRegionMat.region_code)].IsNotEmptyOrNull())
|
||||
{
|
||||
regionCode = input.data[nameof(BasRegionMat.region_code)].ToString();
|
||||
}
|
||||
if (input.data.ContainsKey(nameof(BasRegionMat.material_type)) && input.data[nameof(BasRegionMat.material_type)].IsNotEmptyOrNull())
|
||||
{
|
||||
materialType = input.data[nameof(BasRegionMat.material_type)].ToString();
|
||||
}
|
||||
var blTrueAll = new List<bool> { regionCode.IsNullOrWhiteSpace(), materialType.IsNullOrWhiteSpace() };
|
||||
if (blTrueAll.All(b => !b))
|
||||
{
|
||||
if (s_materialCategoryMap.Count == 0)
|
||||
{
|
||||
s_materialCategoryMap = await _dataDictionaryService.GetDictionaryByTypeId(DictConst.MaterialCatagoryID);
|
||||
}
|
||||
var regionMat = await _db.Queryable<BasRegionMat>().FirstAsync(it => it.region_code == regionCode && it.material_type == materialType);
|
||||
if (regionMat != null)
|
||||
{
|
||||
throw new AppFriendlyException($"区域:【{regionCode}】,物料:【{s_materialCategoryMap[materialType]?.ToString()}】已存在", 500);
|
||||
}
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
await _runService.Create(templateEntity, input);
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
respTask = Task.FromResult(0);
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
|
||||
return await respTask;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public partial class ToolMolds : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 成长周期
|
||||
/// </summary>
|
||||
public int? growth_cycle { get; set; }
|
||||
public decimal? growth_cycle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 型腔数
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Dynamic;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
@@ -7,10 +8,12 @@ using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
@@ -34,12 +37,16 @@ namespace Tnb.EquipMgr
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IBillRullService _billRuleService;
|
||||
private readonly IUserManager _userManager;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
|
||||
public ToolMoldRequisitionService(
|
||||
ISqlSugarRepository<ToolMoldRequisition> repository,
|
||||
IRunService runService,
|
||||
IVisualDevService visualDevService
|
||||
IVisualDevService visualDevService,
|
||||
IBillRullService billRullService,
|
||||
IUserManager userManager
|
||||
)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
@@ -47,6 +54,8 @@ namespace Tnb.EquipMgr
|
||||
_visualDevService = visualDevService;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
OverideFuncs.CreateAsync = Create;
|
||||
_billRuleService= billRullService;
|
||||
_userManager= userManager;
|
||||
}
|
||||
|
||||
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
@@ -96,13 +105,42 @@ namespace Tnb.EquipMgr
|
||||
|
||||
return PageResult<ToolMoldRequisitionListOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
private DateTime GetDateTime(long value)
|
||||
{
|
||||
|
||||
DateTime unixStartTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
DateTime dateTime = unixStartTime.AddMilliseconds(value);
|
||||
return dateTime;
|
||||
}
|
||||
private async Task<dynamic> Create(VisualDevModelDataCrInput input)
|
||||
{
|
||||
string Code = await _billRuleService.GetBillNumber("moldRequisition");
|
||||
DbResult<bool> result = await _db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
await _runService.Create(templateEntity, input);
|
||||
ToolMoldRequisition toolMoldRequisition = new ToolMoldRequisition();
|
||||
toolMoldRequisition.code = Code;
|
||||
toolMoldRequisition.mold_id= input.data[nameof(ToolMoldRequisition.mold_id)].ToString();
|
||||
toolMoldRequisition.mo_task_id = input.data[nameof(ToolMoldRequisition.mo_task_id)].ToString();
|
||||
toolMoldRequisition.equip_id = input.data[nameof(ToolMoldRequisition.equip_id)].ToString();
|
||||
if (input.data[nameof(ToolMoldRequisition.requisition_time)] != null)
|
||||
{
|
||||
toolMoldRequisition.requisition_time = GetDateTime(long.Parse(input.data[nameof(ToolMoldRequisition.requisition_time)].ToString()!));
|
||||
}
|
||||
if (input.data[nameof(ToolMoldRequisition.estimated_return_time)] != null)
|
||||
{
|
||||
toolMoldRequisition.estimated_return_time = GetDateTime(long.Parse(input.data[nameof(ToolMoldRequisition.estimated_return_time)].ToString()!));
|
||||
}
|
||||
|
||||
toolMoldRequisition.recipient_id = input.data[nameof(ToolMoldRequisition.recipient_id)].ToString();
|
||||
if (input.data.ContainsKey(nameof(ToolMoldRequisition.remark)))
|
||||
{
|
||||
toolMoldRequisition.remark = input.data[nameof(ToolMoldRequisition.remark)].ToString();
|
||||
}
|
||||
toolMoldRequisition.create_time = DateTime.Now;
|
||||
toolMoldRequisition.create_id = _userManager.UserId;
|
||||
await _db.Insertable(toolMoldRequisition).ExecuteCommandAsync();
|
||||
// VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
// await _runService.Create(templateEntity, input);
|
||||
|
||||
|
||||
_ = await _db.Updateable<ToolMolds>().SetColumns(x => x.mold_status == Tnb.BasicData.DictConst.SCTypeId)
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
@@ -25,29 +27,60 @@ namespace Tnb.EquipMgr
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IBillRullService _billRuleService;
|
||||
private readonly IUserManager _userManager;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
|
||||
public ToolMoldReturnService(
|
||||
ISqlSugarRepository<ToolMoldReturn> repository,
|
||||
IRunService runService,
|
||||
IVisualDevService visualDevService
|
||||
IVisualDevService visualDevService,
|
||||
IBillRullService billRullService,
|
||||
IUserManager userManager
|
||||
)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_runService = runService;
|
||||
_visualDevService = visualDevService;
|
||||
OverideFuncs.CreateAsync = Create;
|
||||
_billRuleService= billRullService;
|
||||
_userManager = userManager;
|
||||
}
|
||||
private DateTime GetDateTime(long value)
|
||||
{
|
||||
|
||||
DateTime unixStartTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
DateTime dateTime = unixStartTime.AddMilliseconds(value);
|
||||
return dateTime;
|
||||
}
|
||||
private async Task<dynamic> Create(VisualDevModelDataCrInput input)
|
||||
{
|
||||
string Code = await _billRuleService.GetBillNumber("moldReturn");
|
||||
DbResult<bool> result = await _db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
await _runService.Create(templateEntity, input);
|
||||
ToolMoldReturn toolMoldReturn = new ToolMoldReturn();
|
||||
toolMoldReturn.code = Code;
|
||||
toolMoldReturn.mold_id = input.data[nameof(ToolMoldReturn.mold_id)].ToString();
|
||||
toolMoldReturn.location_id = input.data[nameof(ToolMoldReturn.location_id)].ToString();
|
||||
if (input.data[nameof(ToolMoldReturn.return_id)] != null)
|
||||
{
|
||||
toolMoldReturn.return_id = input.data[nameof(ToolMoldReturn.return_id)].ToString();
|
||||
}
|
||||
if (input.data[nameof(ToolMoldReturn.return_time)] != null)
|
||||
{
|
||||
toolMoldReturn.return_time = GetDateTime(long.Parse(input.data[nameof(ToolMoldReturn.return_time)].ToString()!));
|
||||
}
|
||||
if (input.data.ContainsKey(nameof(ToolMoldReturn.remark)))
|
||||
{
|
||||
toolMoldReturn.remark = input.data[nameof(ToolMoldReturn.remark)].ToString();
|
||||
}
|
||||
toolMoldReturn.create_time = DateTime.Now;
|
||||
toolMoldReturn.create_id = _userManager.UserId;
|
||||
// VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
//await _runService.Create(templateEntity, input);
|
||||
await _db.Insertable(toolMoldReturn).ExecuteCommandAsync();
|
||||
|
||||
|
||||
string? locationId = "";
|
||||
string ? locationId = "";
|
||||
if (input.data.TryGetValue("location_id", out object? value))
|
||||
{
|
||||
locationId = value.ToString();
|
||||
|
||||
@@ -72,7 +72,12 @@ namespace Tnb.EquipMgr
|
||||
|
||||
private async Task<dynamic> Update(string id, VisualDevModelDataUpInput visualDevModelDataUpInput)
|
||||
{
|
||||
string? qrcode = visualDevModelDataUpInput.data.ContainsKey("qrcode") ? visualDevModelDataUpInput.data["qrcode"].ToString() : "";
|
||||
string? qrcode = string.Empty;
|
||||
if (visualDevModelDataUpInput.data.ContainsKey("qrcode") && visualDevModelDataUpInput.data["qrcode"] != null)
|
||||
{
|
||||
qrcode = visualDevModelDataUpInput.data["qrcode"].ToString();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(qrcode) && await _repository.AsSugarClient().Queryable<BasQrcode>().AnyAsync(x => x.code == visualDevModelDataUpInput.data["qrcode"] && x.source_id != id))
|
||||
{
|
||||
throw Oops.Bah("二维码总表中已存在该二维码");
|
||||
|
||||
@@ -59,11 +59,12 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
Dictionary<string, string>? queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson) : new Dictionary<string, string>();
|
||||
string moCode = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : "";
|
||||
List<PrdMoTaskTreeOutput> list = await _repository.AsSugarClient().Queryable<PrdMoTask>()
|
||||
var list = await _repository.AsSugarClient().Queryable<PrdMoTask>()
|
||||
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||
.LeftJoin<ToolMolds>((a, b, c) => a.mold_id == c.id)
|
||||
.LeftJoin<EqpEquipment>((a, b, c, d) => a.eqp_id == d.id)
|
||||
.WhereIF(!string.IsNullOrEmpty(moCode), (a, b, c, d) => a.mo_task_code!.Contains(moCode))
|
||||
.Where(a=>string.IsNullOrEmpty(a.parent_id))
|
||||
.Select((a, b, c, d) => new PrdMoTaskTreeOutput()
|
||||
{
|
||||
id = a.id,
|
||||
@@ -78,20 +79,20 @@ namespace Tnb.ProductionMgr
|
||||
estimated_start_date = a.estimated_start_date!.ToString(),
|
||||
estimated_end_date = a.estimated_end_date.ToString(),
|
||||
create_time = a.create_time.ToString()
|
||||
}).ToListAsync();
|
||||
List<PrdMoTaskTreeOutput> treeList = list.ToTree();
|
||||
treeList = treeList.Skip((input.currentPage - 1) * input.pageSize).Take(input.pageSize).ToList();
|
||||
SqlSugarPagedList<PrdMoTaskTreeOutput> pagedList = new()
|
||||
{
|
||||
list = treeList,
|
||||
pagination = new Pagination
|
||||
{
|
||||
CurrentPage = input.currentPage,
|
||||
PageSize = input.pageSize,
|
||||
Total = treeList.Count
|
||||
}
|
||||
};
|
||||
return PageResult<PrdMoTaskTreeOutput>.SqlSugarPageResult(pagedList);
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
// List<PrdMoTaskTreeOutput> treeList = list.ToTree();
|
||||
// treeList = treeList.Skip((input.currentPage - 1) * input.pageSize).Take(input.pageSize).ToList();
|
||||
// SqlSugarPagedList<PrdMoTaskTreeOutput> pagedList = new()
|
||||
// {
|
||||
// list = treeList,
|
||||
// pagination = new Pagination
|
||||
// {
|
||||
// CurrentPage = input.currentPage,
|
||||
// PageSize = input.pageSize,
|
||||
// Total = treeList.Count
|
||||
// }
|
||||
// };
|
||||
return PageResult<PrdMoTaskTreeOutput>.SqlSugarPageResult(list);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Tnb.QcMgr
|
||||
.LeftJoin<BasProcess>((a, b, c) => a.processid == c.id)
|
||||
.LeftJoin<OrganizeEntity>((a, b, c, d) => a.workid == d.Id)
|
||||
.LeftJoin<UserEntity>((a, b, c, d, e) => a.execuser == e.Id)
|
||||
.WhereIF(!string.IsNullOrEmpty(materialid), (a, b, c, d, e) => a.materialid == materialid)
|
||||
.WhereIF(!string.IsNullOrEmpty(materialid), (a, b, c, d, e) => b.name.Contains(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)
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Tnb.QcMgr
|
||||
.LeftJoin<BasProcess>((a, b, c) => a.processid == c.id)
|
||||
.LeftJoin<OrganizeEntity>((a, b, c, d) => a.workid == d.Id)
|
||||
.LeftJoin<UserEntity>((a, b, c, d, e) => a.execuser == e.Id)
|
||||
.WhereIF(!string.IsNullOrEmpty(materialid), (a, b, c, d, e) => a.materialid == materialid)
|
||||
.WhereIF(!string.IsNullOrEmpty(materialid), (a, b, c, d,e) => b.name.Contains(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)
|
||||
|
||||
@@ -195,4 +195,9 @@ public class ModuleConsts
|
||||
/// 模块标识-在库物料维护
|
||||
/// </summary>
|
||||
public const string MODULE_WMSINSTKMIN_ID = "27124095468309";
|
||||
/// <summary>
|
||||
/// 模块标识-区域物料设定
|
||||
/// </summary>
|
||||
public const string MODULE_BASREGIONMAT_ID = "26187428200229";
|
||||
|
||||
}
|
||||
@@ -265,5 +265,7 @@
|
||||
/// 盘点任务计算状态-未结算
|
||||
/// </summary>
|
||||
public const string CLOSINGSTATUS_WJS_ID = "27674058079509";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,10 +44,6 @@ public partial class WmsElevatorH : BaseEntity<string>
|
||||
/// </summary>
|
||||
public string elevator_group { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public int status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 任务数量
|
||||
|
||||
@@ -59,4 +59,11 @@ public partial class WmsElevatorH
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string device_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "status")]
|
||||
public int enable_mark { get; set; }
|
||||
|
||||
}
|
||||
|
||||
18
WarehouseMgr/Tnb.WarehouseMgr/BasRegionMatService.cs
Normal file
18
WarehouseMgr/Tnb.WarehouseMgr/BasRegionMatService.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.VisualDev;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 区域物料设定
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_BASREGIONMAT_ID)]
|
||||
public class BasRegionMatService :BaseWareHouseService
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using JNPF;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
@@ -12,6 +14,7 @@ using JNPF.EventBus;
|
||||
using JNPF.Extras.CollectiveOAuth.Enums;
|
||||
using JNPF.VisualDev;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
@@ -37,7 +40,24 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
protected IEventPublisher? EventPublisher { set; get; }
|
||||
|
||||
protected ILogger Logger => LoggerFactory.Create(builder => builder.AddFile($"{AppContext.BaseDirectory}/logs/{this.GetType().Name}{DateTime.Now:yyyyMMdd}.log", cfgOpts =>
|
||||
{
|
||||
|
||||
//cfgOpts.DateFormat = "yyyy-MM-dd HH:mm:ss.fff";
|
||||
cfgOpts.MessageFormat = (logMsg) =>
|
||||
{
|
||||
Span<char> span = logMsg.LogLevel.ToString().ToCharArray();
|
||||
StringBuilder sb = new();
|
||||
_ = sb.Append($"{span[..4]} ");
|
||||
_ = sb.Append($"{logMsg.LogName} ");
|
||||
_ = sb.Append($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} ");
|
||||
_ = sb.Append($"#{logMsg.EventId.Id} ");
|
||||
_ = sb.Append(logMsg.Message + " ");
|
||||
_ = sb.Append(logMsg.Exception?.ToString());
|
||||
return sb.ToString();
|
||||
};
|
||||
|
||||
})).CreateLogger(this.GetType());
|
||||
|
||||
|
||||
static BaseWareHouseService()
|
||||
@@ -300,6 +320,8 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region 斑马打印
|
||||
/// <summary>
|
||||
/// 打印
|
||||
@@ -347,7 +369,7 @@ namespace Tnb.WarehouseMgr
|
||||
// tcs.SetResult(printerList);
|
||||
// return tcs.Task;
|
||||
//}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Api响应结果
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// Wms设备接口提供程序服务类
|
||||
/// </summary>
|
||||
|
||||
public class DeviceProviderService : BaseWareHouseService<DeviceProviderService>
|
||||
public class DeviceProviderService : ServiceLoggerBase<DeviceProviderService>
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IWareHouseService _wareHouseService;
|
||||
|
||||
@@ -6,17 +6,19 @@ using Tnb.WarehouseMgr.Entities;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
public class BaseWareHouseService<T> : BaseWareHouseService
|
||||
public class ServiceLoggerBase<TService> : BaseWareHouseService
|
||||
{
|
||||
protected static Dictionary<string, object> s_elevatorMap = new();
|
||||
private static readonly Lazy<Task> initializationTask;
|
||||
|
||||
|
||||
static BaseWareHouseService()
|
||||
static ServiceLoggerBase()
|
||||
{
|
||||
initializationTask = new Lazy<Task>(InitializeAsync);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static async Task InitializeAsync()
|
||||
{
|
||||
|
||||
@@ -37,24 +39,24 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
|
||||
|
||||
protected ILogger Logger => LoggerFactory.Create(builder => builder.AddFile($"{AppContext.BaseDirectory}/logs/custom{DateTime.Now:yyyyMMdd}.log", cfgOpts =>
|
||||
{
|
||||
//protected ILogger Logger => LoggerFactory.Create(builder => builder.AddFile($"{AppContext.BaseDirectory}/logs/{this.GetType().Name}{DateTime.Now:yyyyMMdd}.log", cfgOpts =>
|
||||
//{
|
||||
|
||||
//cfgOpts.DateFormat = "yyyy-MM-dd HH:mm:ss.fff";
|
||||
cfgOpts.MessageFormat = (logMsg) =>
|
||||
{
|
||||
Span<char> span = logMsg.LogLevel.ToString().ToCharArray();
|
||||
StringBuilder sb = new();
|
||||
_ = sb.Append($"{span[..4]} ");
|
||||
_ = sb.Append($"{logMsg.LogName} ");
|
||||
_ = sb.Append($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} ");
|
||||
_ = sb.Append($"#{logMsg.EventId.Id} ");
|
||||
_ = sb.Append(logMsg.Message + " ");
|
||||
_ = sb.Append(logMsg.Exception?.ToString());
|
||||
return sb.ToString();
|
||||
};
|
||||
// //cfgOpts.DateFormat = "yyyy-MM-dd HH:mm:ss.fff";
|
||||
// cfgOpts.MessageFormat = (logMsg) =>
|
||||
// {
|
||||
// Span<char> span = logMsg.LogLevel.ToString().ToCharArray();
|
||||
// StringBuilder sb = new();
|
||||
// _ = sb.Append($"{span[..4]} ");
|
||||
// _ = sb.Append($"{logMsg.LogName} ");
|
||||
// _ = sb.Append($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} ");
|
||||
// _ = sb.Append($"#{logMsg.EventId.Id} ");
|
||||
// _ = sb.Append(logMsg.Message + " ");
|
||||
// _ = sb.Append(logMsg.Exception?.ToString());
|
||||
// return sb.ToString();
|
||||
// };
|
||||
|
||||
})).CreateLogger<T>();
|
||||
//})).CreateLogger(this.GetType());
|
||||
}
|
||||
|
||||
public static class CustomLoggerExtenstions
|
||||
@@ -33,7 +33,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// <summary>
|
||||
/// 库房业务类(出入库)
|
||||
/// </summary>
|
||||
public class WareHouseService : BaseWareHouseService<WareHouseService>, IWareHouseService
|
||||
public class WareHouseService : ServiceLoggerBase<WareHouseService>, IWareHouseService
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IDictionaryDataService _dictionaryDataService;
|
||||
@@ -977,9 +977,9 @@ namespace Tnb.WarehouseMgr
|
||||
if (curEleDs?.Count > 0)
|
||||
{
|
||||
//当前电梯
|
||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.status == 1);
|
||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.enable_mark == 1);
|
||||
//同电梯组电梯
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.status == 1).ToListAsync();
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.enable_mark == 1).ToListAsync();
|
||||
|
||||
if (curEle == null && sGpEle?.Count > 0)
|
||||
{
|
||||
@@ -1048,9 +1048,9 @@ namespace Tnb.WarehouseMgr
|
||||
if (curEleDs?.Count > 0)
|
||||
{
|
||||
//当前电梯
|
||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.status == 1);
|
||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.enable_mark == 1);
|
||||
//同电梯组电梯
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.status == 1).ToListAsync();
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.enable_mark == 1).ToListAsync();
|
||||
|
||||
if (curEle == null && sGpEle?.Count > 0)
|
||||
{
|
||||
|
||||
29
WarehouseMgr/Tnb.WarehouseMgr/WmsBasicDataBase`1.cs
Normal file
29
WarehouseMgr/Tnb.WarehouseMgr/WmsBasicDataBase`1.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Contracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// Wms基础数据基类
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity"></typeparam>
|
||||
//public class WmsBasicDataBase<TEntity> : BaseWareHouseService where TEntity : BaseEntity<string>, new()
|
||||
//{
|
||||
// private readonly ISqlSugarClient _db;
|
||||
// public WmsBasicDataBase()
|
||||
// {
|
||||
|
||||
// }
|
||||
// [HttpPost]
|
||||
// public async Task<bool> IsEnabledMark(IEnumerable<string> ids,int status)
|
||||
// {
|
||||
|
||||
// }
|
||||
//}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// 盘点任务
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCHECKTASK_ID)]
|
||||
public class WmsCheckTaskService : BaseWareHouseService<WmsCheckTaskService>
|
||||
public class WmsCheckTaskService : ServiceLoggerBase<WmsCheckTaskService>
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IWareHouseService _warehouseService;
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Tnb.WarehouseMgr
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSEMPTYINSTOCK_ID)]
|
||||
[ServiceModule(BizTypeId)]
|
||||
|
||||
public class WmsEmptyInstockService : BaseWareHouseService<WmsEmptyInstockService>, IWmsEmptyInstockService
|
||||
public class WmsEmptyInstockService : ServiceLoggerBase<WmsEmptyInstockService>, IWmsEmptyInstockService
|
||||
{
|
||||
private const string BizTypeId = "26121986416677";
|
||||
private readonly ISqlSugarClient _db;
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSOUTSTOCK_ID)]
|
||||
[ServiceModule(BizTypeId)]
|
||||
public class WmsOutStockService : BaseWareHouseService<WmsOutStockService>, IWmsOutStockService
|
||||
public class WmsOutStockService : ServiceLoggerBase<WmsOutStockService>, IWmsOutStockService
|
||||
{
|
||||
private const string BizTypeId = "26191522660645";
|
||||
private readonly ISqlSugarClient _db;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using Mapster;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
@@ -29,11 +31,18 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
private async Task<dynamic> GetListAsync(VisualDevModelListQueryInput input)
|
||||
{
|
||||
var materialCode = "";
|
||||
if (!input.queryJson.IsNullOrWhiteSpace())
|
||||
{
|
||||
materialCode = JObject.Parse(input.queryJson).Value<string>(nameof(WmsCarryCode.material_code));
|
||||
}
|
||||
|
||||
List<WmsStockReportH> items = await _db.Queryable<WmsCarryCode>().InnerJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||
.InnerJoin<BasMaterialSendWarehouse>((a, b, c) => b.id == c.material_id)
|
||||
.InnerJoin<WmsCarryH>((a, b, c, d) => a.carry_id == d.id)
|
||||
.InnerJoin<BasLocation>((a, b, c, d, e) => d.location_id == e.id)
|
||||
.Where((a, b, c, d, e) => e.is_type == ((int)EnumLocationType.存储库位).ToString())
|
||||
.WhereIF(!string.IsNullOrEmpty(materialCode), (a, b, c, d, e) => a.material_code.Contains(materialCode))
|
||||
.Select((a, b, c, d, e) => new WmsStockReportH
|
||||
{
|
||||
warehouse_id = a.warehouse_id,
|
||||
|
||||
Reference in New Issue
Block a user