This commit is contained in:
alex
2023-08-04 17:17:34 +08:00
6 changed files with 160 additions and 1 deletions

View File

@@ -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; }

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.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
/// </summary>
[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<QcCheckExecH> _repository;
private readonly IUserManager _userManager;
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
public QcCheckTaskService(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);
}
/// <summary>
/// 获取任务执行明细

View File

@@ -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,

View File

@@ -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();
}

View File

@@ -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<WmsInstockD>()