模具退还
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.EquipMgr.Entities
|
||||
{
|
||||
public class ToolMoldReturnListOutput
|
||||
{
|
||||
public string? id { get; set; }
|
||||
public string? code { get; set; }
|
||||
public string? mold_id { get; set; }
|
||||
public string? return_id { get; set; }
|
||||
public string? location_id { get; set; }
|
||||
public string? location_id_id { get; set; }
|
||||
public string? return_time { get; set; }
|
||||
public string? remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
@@ -61,7 +62,7 @@ namespace Tnb.EquipMgr
|
||||
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
Dictionary<string, object>? queryJson = new();
|
||||
string? requisitionCode = "";
|
||||
string? code = "";
|
||||
DateTime[]? requisitionTimeArr = null;
|
||||
DateTime[]? estimatedReturnArr = null;
|
||||
if (input != null && !string.IsNullOrEmpty(input.queryJson))
|
||||
@@ -69,9 +70,9 @@ namespace Tnb.EquipMgr
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, object>>(input?.queryJson ?? "");
|
||||
}
|
||||
|
||||
if (queryJson!.TryGetValue("requisition_code", out object? value))
|
||||
if (queryJson!.TryGetValue("code", out object? value))
|
||||
{
|
||||
requisitionCode = value.ToString();
|
||||
code = value.ToString();
|
||||
}
|
||||
if (queryJson!.TryGetValue("requisition_time", out object? value1))
|
||||
{
|
||||
@@ -87,7 +88,7 @@ namespace Tnb.EquipMgr
|
||||
.LeftJoin<EqpEquipment>((a, b, c) => a.equip_id == c.id)
|
||||
.LeftJoin<UserEntity>((a, b, c, d) => a.recipient_id == d.Id)
|
||||
.LeftJoin<ToolMolds>((a, b, c, d, e) => a.mold_id == e.id)
|
||||
.WhereIF(!string.IsNullOrEmpty(requisitionCode), (a, b, c, d) => a.code.Contains(requisitionCode))
|
||||
.WhereIF(!string.IsNullOrEmpty(code), (a, b, c, d) => a.code.Contains(code))
|
||||
.WhereIF(requisitionTimeArr != null, (a, b, c, d) => a.requisition_time >= requisitionTimeArr[0] && a.requisition_time <= requisitionTimeArr[1])
|
||||
.WhereIF(estimatedReturnArr != null, (a, b, c, d) => a.estimated_return_time >= estimatedReturnArr[0] && a.estimated_return_time <= estimatedReturnArr[1])
|
||||
.Select((a, b, c, d, e) => new ToolMoldRequisitionListOutput
|
||||
|
||||
@@ -1,16 +1,24 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
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 Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.Util;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
@@ -45,6 +53,47 @@ namespace Tnb.EquipMgr
|
||||
OverideFuncs.CreateAsync = Create;
|
||||
_billRuleService= billRullService;
|
||||
_userManager = userManager;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
}
|
||||
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
Dictionary<string, object>? queryJson = new();
|
||||
string? code = "";
|
||||
DateTime[]? returntime = null;
|
||||
if (input != null && !string.IsNullOrEmpty(input.queryJson))
|
||||
{
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, object>>(input?.queryJson ?? "");
|
||||
}
|
||||
|
||||
if (queryJson!.TryGetValue("code", out object? value))
|
||||
{
|
||||
code = value.ToString();
|
||||
}
|
||||
if (queryJson!.TryGetValue("return_time", out object? value1))
|
||||
{
|
||||
returntime = value1.ToObject<long[]>().Select(x => DateTimeOffset.FromUnixTimeSeconds(x / 1000).ToLocalTime().DateTime).ToArray();
|
||||
}
|
||||
|
||||
|
||||
SqlSugarPagedList<ToolMoldReturnListOutput> result = await _db.Queryable<ToolMoldReturn>()
|
||||
.LeftJoin<ToolLocation> ((a, b) => a.location_id == b.id)
|
||||
.LeftJoin<UserEntity>((a, b, c) => a.return_id == c.Id)
|
||||
.LeftJoin<ToolMolds>((a, b, c, d) => a.mold_id == d.id)
|
||||
.WhereIF(!string.IsNullOrEmpty(code), (a, b, c, d) => a.code.Contains(code))
|
||||
.WhereIF(returntime != null, (a, b, c, d) => a.return_time >= returntime[0] && a.return_time <= returntime[1])
|
||||
.Select((a, b, c, d) => new ToolMoldReturnListOutput
|
||||
{
|
||||
id = a.id,
|
||||
code = a.code,
|
||||
mold_id = d.mold_code,
|
||||
return_id = c.RealName,
|
||||
location_id = b.location_code,
|
||||
location_id_id = a.location_id,
|
||||
return_time = a.return_time == null ? "" : a.return_time.Value.ToString("yyyy-MM-dd"),
|
||||
remark = a.remark
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<ToolMoldReturnListOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
private DateTime GetDateTime(long value)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user