This commit is contained in:
FanLian
2023-08-04 15:31:32 +08:00
5 changed files with 171 additions and 2 deletions

View File

@@ -6,6 +6,22 @@ using System.Threading.Tasks;
namespace Tnb.QcMgr.Entities.Dto 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 class CheckTaskOut
{ {
public string? mainid { get; set; } public string? mainid { get; set; }

View File

@@ -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
{ /// <summary>
/// 质检任务模块
/// </summary>
[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<QcCheckExecH> _repository;
private readonly IUserManager _userManager;
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
public QcCheckTaskResultServic(ISqlSugarRepository<QcCheckExecH> repository, IUserManager userManager)
{
_repository = repository;
_userManager = userManager;
OverideFuncs.GetListAsync = GetListAsync;
}
private async Task<dynamic> GetListAsync(VisualDevModelListQueryInput input)
{
var db = _repository.AsSugarClient();
Dictionary<string, string> queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson) : new Dictionary<string, string>();
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<DictionaryDataEntity>()
.LeftJoin<DictionaryTypeEntity>((a, b) => a.DictionaryTypeId == b.Id)
.Where((a, b) => b.FullName == "质检状态" || b.FullName == "质检类型选择").ToListAsync();
var result = await db.Queryable<QcCheckExecH>()
.LeftJoin<BasMaterial>((a, b) => a.materialid == b.id)
.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(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<QcCheckExecHOut>.SqlSugarPageResult(result);
}
}
}

View File

@@ -1,11 +1,13 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Aspose.Cells.Drawing; using Aspose.Cells.Drawing;
using JNPF.Common.Core.Manager; using JNPF.Common.Core.Manager;
using JNPF.Common.Enums; using JNPF.Common.Enums;
using JNPF.Common.Filter;
using JNPF.Common.Security; using JNPF.Common.Security;
using JNPF.DependencyInjection; using JNPF.DependencyInjection;
using JNPF.DynamicApiController; using JNPF.DynamicApiController;
@@ -13,13 +15,22 @@ using JNPF.FriendlyException;
using JNPF.JsonSerialization; using JNPF.JsonSerialization;
using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.Permission;
using JNPF.Systems.Entitys.System; using JNPF.Systems.Entitys.System;
using JNPF.VisualDev;
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using SqlSugar; 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;
using Tnb.QcMgr.Entities.Dto; using Tnb.QcMgr.Entities.Dto;
using Tnb.QcMgr.Entities.Entity; using Tnb.QcMgr.Entities.Entity;
using Tnb.QcMgr.Interfaces; using Tnb.QcMgr.Interfaces;
using JNPF.Common.Extension;
namespace Tnb.QcMgr namespace Tnb.QcMgr
{ {
@@ -28,14 +39,60 @@ namespace Tnb.QcMgr
/// </summary> /// </summary>
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 800)] [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 800)]
[Route("api/[area]/[controller]/[action]")] [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<QcCheckExecH> _repository; private readonly ISqlSugarRepository<QcCheckExecH> _repository;
private readonly IUserManager _userManager; private readonly IUserManager _userManager;
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
public QcCheckTaskService(ISqlSugarRepository<QcCheckExecH> repository, IUserManager userManager) public QcCheckTaskService(ISqlSugarRepository<QcCheckExecH> repository, IUserManager userManager)
{ {
_repository = repository; _repository = repository;
_userManager = userManager; _userManager = userManager;
OverideFuncs.GetListAsync = GetListAsync;
}
private async Task<dynamic> GetListAsync(VisualDevModelListQueryInput input)
{
var db = _repository.AsSugarClient();
Dictionary<string, string> queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson) : new Dictionary<string, string>();
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<DictionaryDataEntity>()
.LeftJoin<DictionaryTypeEntity>((a, b) => a.DictionaryTypeId == b.Id)
.Where((a, b) => b.FullName == "质检状态" || b.FullName == "质检类型选择").ToListAsync();
var result = await db.Queryable<QcCheckExecH>()
.LeftJoin<BasMaterial>((a, b) => a.materialid == b.id)
.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(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<QcCheckExecHOut>.SqlSugarPageResult(result);
} }
/// <summary> /// <summary>
/// 获取任务执行明细 /// 获取任务执行明细

View File

@@ -4,6 +4,9 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using JNPF.VisualDev; using JNPF.VisualDev;
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
using MimeKit.Cryptography;
using SqlSugar;
namespace Tnb.WarehouseMgr namespace Tnb.WarehouseMgr
{ {
@@ -13,5 +16,15 @@ namespace Tnb.WarehouseMgr
[OverideVisualDev(ModuleConsts.MODULE_WMSSTOCKREPORT_ID)] [OverideVisualDev(ModuleConsts.MODULE_WMSSTOCKREPORT_ID)]
public class WmsStockReportService:BaseWareHouseService public class WmsStockReportService:BaseWareHouseService
{ {
public WmsStockReportService()
{
OverideFuncs.GetListAsync = GetListAsync;
}
private async Task<dynamic> GetListAsync(VisualDevModelListQueryInput input)
{
return null;
}
} }
} }

View File

@@ -238,7 +238,7 @@ namespace Tnb.WarehouseMgr
area_code = it.Key, area_code = it.Key,
require_id = ko.id, require_id = ko.id,
require_code = ko.bill_code, require_code = ko.bill_code,
create_id = curUser.FindFirst(ClaimConst.CLAINMUSERID)?.Value, create_id = curUser.FindFirst(ClaimConst.CLAINMUSERID)?.Value!,
create_time = DateTime.Now, create_time = DateTime.Now,
source_id = ko.source_id, source_id = ko.source_id,
source_code = ko.source_code source_code = ko.source_code