vxe模式的tree表格

This commit is contained in:
DESKTOP-H2PAFLR\Administrator
2023-10-06 16:09:13 +08:00
parent 50c0a7a016
commit f4af5818c8
7 changed files with 528 additions and 46 deletions

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.mes.md;
namespace ZR.Service.MES.md.IService
{
public interface IMdBOMService
{
int AddWorkline(MdBom workline);
public (int, List<MdBom>) GetAll(string productCode, string productName, int pageNum, int pageSize);
public int UpdateWorkline(MdBom workline);
public int deleteWorkline(int[] ids);
}
}

View File

@@ -0,0 +1,93 @@
using Infrastructure.Attribute;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.mes.md;
using ZR.Service.mes.md.IService;
using ZR.Service.MES.md.IService;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace ZR.Service.MES.md
{
[AppService(ServiceType = typeof(IMdBOMService), ServiceLifetime = LifeTime.Transient)]
public class MdBOMService : BaseService<MdWorkstation>, IMdBOMService
{
int IMdBOMService.AddWorkline(MdBom workline)
{
throw new NotImplementedException();
}
int IMdBOMService.deleteWorkline(int[] ids)
{
throw new NotImplementedException();
}
(int, List<MdBom>) IMdBOMService.GetAll(string productCode, string productName, int pageNum, int pageSize)
{
int totalNum = 0;
if (string.IsNullOrEmpty(productCode) && string.IsNullOrEmpty(productName))
{
var data = Context.Queryable<MdBom>().ToPageList(pageNum, pageSize,ref totalNum);
return (totalNum, data);
}
else
{
//1. 查询本体
var predicate = Expressionable.Create<MdBom>()
.AndIF(!string.IsNullOrEmpty(productCode), it => it.ProductCode.Contains(productCode))
.AndIF(!string.IsNullOrEmpty(productName), it => it.ProductName.Contains(productName))
.ToExpression();
List<MdBom> data = Context.Queryable<MdBom>().Where(predicate).ToList();
//2. 查询儿子
if (data != null & data.Count > 0)
{
List<MdBom> data1 = new List<MdBom>();
List<MdBom> data2 = new List<MdBom>();
foreach (var item in data)
{
List<MdBom> dataItems = Context.Queryable<MdBom>().Where(it => it.ParentProductId == item.Id).ToList();
data1.AddRange(dataItems);
dataItems.Clear();
// 3. 查询孙子
if (data1 != null & data1.Count > 0)
{
foreach (var item1 in data1)
{
List<MdBom> dataItemss = Context.Queryable<MdBom>().Where(it1 => it1.ParentProductId == item1.Id).ToList();
data2.AddRange(dataItemss);
dataItemss.Clear();
}
}
}
data.AddRange(data1);
data.AddRange(data2);
}
return (data.Count(),data);
}
}
int IMdBOMService.UpdateWorkline(MdBom workline)
{
throw new NotImplementedException();
}
}
}