bug
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Security;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
{
|
||||
public class PrdMoListTreeOutput
|
||||
{
|
||||
|
||||
//public Dictionary<string, object> row { get; set; }
|
||||
|
||||
#region 注释代码
|
||||
public string? org_id { get; set; }
|
||||
/// <summary>
|
||||
/// 工单id
|
||||
/// </summary>
|
||||
|
||||
public string mo_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工单代码
|
||||
/// </summary>
|
||||
public string mo_code { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 物料编号
|
||||
/// </summary>
|
||||
public string? material_code { get; set; }
|
||||
/// <summary>
|
||||
/// 物料名称
|
||||
/// </summary>
|
||||
public string material_name { get; set; }
|
||||
/// <summary>
|
||||
/// 物料规格型号
|
||||
/// </summary>
|
||||
public string material_standard { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工单类型:1-正常工单、2-返工工单、3-试制工单
|
||||
/// </summary>
|
||||
public string? mo_type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生产状态 Initial: 初始, Confirm:确认 Release: 下发, Open: 生产中, Close: 关单, Pending: 暂停
|
||||
/// </summary>
|
||||
public string? mo_status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 计划生产数量
|
||||
/// </summary>
|
||||
public string plan_qty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 已投入数量
|
||||
/// </summary>
|
||||
public string input_qty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 已完工数量
|
||||
/// </summary>
|
||||
public string complete_qty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报废数量
|
||||
/// </summary>
|
||||
public string scrap_qty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 计划开始时间
|
||||
/// </summary>
|
||||
public string plan_start_date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 计划结束时间
|
||||
/// </summary>
|
||||
public string plan_end_date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否生派工单
|
||||
/// </summary>
|
||||
public string is_create_dispatch { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 产线代码
|
||||
/// </summary>
|
||||
public string? production_linecode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否合并
|
||||
/// </summary>
|
||||
public string is_merge { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 组合工单
|
||||
/// </summary>
|
||||
public string? combine_mo_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间戳
|
||||
/// </summary>
|
||||
public string? time_stamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public string create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public string modify_time { get; set; }
|
||||
/// <summary>
|
||||
/// 物料ID
|
||||
/// </summary>
|
||||
public string? material_id { get; set; }
|
||||
public string? material_id_id { get; set; }
|
||||
/// <summary>
|
||||
/// 已排产数量
|
||||
/// </summary>
|
||||
public string scheduled_qty { get; set; }
|
||||
/// <summary>
|
||||
/// 父工单id
|
||||
/// </summary>
|
||||
public string parent_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取节点id.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取节点父id.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string parentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有子级.
|
||||
/// </summary>
|
||||
public bool hasChildren { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设置Children.
|
||||
/// </summary>
|
||||
public List<PrdMoListTreeOutput>? children { get; set; } = new List<PrdMoListTreeOutput>();
|
||||
|
||||
/// <summary>
|
||||
/// 子节点数量.
|
||||
/// </summary>
|
||||
public int num { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否为子节点.
|
||||
/// </summary>
|
||||
public bool isLeaf { get; set; } = false;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -426,6 +426,7 @@ namespace Tnb.ProductionMgr
|
||||
// VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(MoModuleId, true);
|
||||
// var data = await _runService.GetListResult(templateEntity, input);
|
||||
//
|
||||
//
|
||||
// if (data?.list?.Count > 0)
|
||||
// {
|
||||
// var parentIdField = nameof(PrdMo.parent_id);
|
||||
@@ -529,7 +530,7 @@ namespace Tnb.ProductionMgr
|
||||
.WhereIF(!string.IsNullOrEmpty(moCode),(a,b,c,d,e)=>a.mo_code.Contains(moCode))
|
||||
.WhereIF(!string.IsNullOrEmpty(combineMoCode),(a,b,c,d,e)=>a.combine_mo_code.Contains(combineMoCode))
|
||||
.OrderByDescending((a,b,c,d,e)=>a.create_time)
|
||||
.Select((a, b, c, d, e) => new PrdMoTreeOutput
|
||||
.Select((a, b, c, d, e) => new PrdMoListTreeOutput
|
||||
{
|
||||
org_id = a.org_id,
|
||||
mo_id = a.id,
|
||||
@@ -557,13 +558,50 @@ namespace Tnb.ProductionMgr
|
||||
scheduled_qty = a.scheduled_qty.Value.ToString(),
|
||||
parent_id = "0",
|
||||
id = a.id,
|
||||
hasChildren = false,
|
||||
num = 0,
|
||||
isLeaf = true,
|
||||
hasChildren = SqlFunc.Subqueryable<PrdMo>().Where(x=>x.parent_id==a.id).Any(),
|
||||
num = SqlFunc.Subqueryable<PrdMo>().Where(x=>x.parent_id==a.id).Count(),
|
||||
isLeaf = SqlFunc.Subqueryable<PrdMo>().Where(x=>x.parent_id==a.id).Any(),
|
||||
children = SqlFunc.Subqueryable<PrdMo>()
|
||||
.LeftJoin<BasMaterial>((h,i) => h.material_id == i.id)
|
||||
.LeftJoin<DictionaryDataEntity>((h,i,j) => h.mo_type == j.Id)
|
||||
.LeftJoin<DictionaryDataEntity>((h,i,j,k) => h.mo_status == k.Id)
|
||||
.LeftJoin<UserEntity>((h,i,j,k,l) => h.create_id == l.Id)
|
||||
.Where((h,i,j,k,l)=>a.id==h.parent_id).ToList((h,i,j,k,l)=>new PrdMoListTreeOutput()
|
||||
{
|
||||
org_id = h.org_id,
|
||||
mo_id = h.id,
|
||||
mo_code = h.mo_code,
|
||||
material_code = i.code,
|
||||
material_name = i.name,
|
||||
material_standard = i.material_standard,
|
||||
mo_type = j.FullName,
|
||||
mo_status = k.FullName,
|
||||
plan_qty = h.plan_qty.Value.ToString(),
|
||||
input_qty = h.input_qty.Value.ToString(),
|
||||
complete_qty = h.complete_qty.Value.ToString(),
|
||||
scrap_qty = h.scrap_qty.Value.ToString(),
|
||||
plan_start_date = h.plan_start_date.Value.ToString("yyyy-MM-dd"),
|
||||
plan_end_date = h.plan_end_date.Value.ToString("yyyy-MM-dd"),
|
||||
is_create_dispatch = h.is_create_dispatch==0 ? "否" : "是",
|
||||
production_linecode = h.production_linecode,
|
||||
is_merge = h.is_merge==0 ? "否" : "是",
|
||||
combine_mo_code = h.combine_mo_code,
|
||||
time_stamp = h.time_stamp,
|
||||
create_id = l.RealName,
|
||||
create_time = h.create_time.Value.ToString("yyyy-MM-dd : HH:mm:ss"),
|
||||
material_id = i.code,
|
||||
material_id_id = h.material_id,
|
||||
scheduled_qty = h.scheduled_qty.Value.ToString(),
|
||||
parent_id = a.id,
|
||||
id = h.id,
|
||||
hasChildren = false,
|
||||
num = 0,
|
||||
isLeaf = true,
|
||||
})
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
|
||||
return PageResult<PrdMoTreeOutput>.SqlSugarPageResult(result);
|
||||
return PageResult<PrdMoListTreeOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user