产品定义
This commit is contained in:
22
ZR.Service/mes/md/IService/IMdProductDefineService.cs
Normal file
22
ZR.Service/mes/md/IService/IMdProductDefineService.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.mes.md.DTO;
|
||||
using ZR.Model.mes.md;
|
||||
|
||||
namespace ZR.Service.mes.md.IService
|
||||
{
|
||||
public interface IMdProductDefineService
|
||||
{
|
||||
public int deleteProductDefine(int[] ids);
|
||||
public MdProductDefineDTO GetList(string name, string code, int pageNum, int pageSize);
|
||||
public List<MdProductDefine> GetList(SearchOptionDTO searchOption);
|
||||
public MdProductDefine GetProductDefinebyPK(int measure);
|
||||
List<MdUnit> GetProductDefineList(string name);
|
||||
List<MdUnit> GetProductDefineList();
|
||||
public int InsertProductDefine(MdProductDefine jo);
|
||||
public int UpdateProductDefine(MdProductDefine paramss);
|
||||
}
|
||||
}
|
||||
17
ZR.Service/mes/md/IService/IMdUnitService.cs
Normal file
17
ZR.Service/mes/md/IService/IMdUnitService.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using ZR.Model.mes.md;
|
||||
using ZR.Model.mes.md.DTO;
|
||||
|
||||
namespace ZR.Service.mes.md.IService;
|
||||
|
||||
public interface IMdUnitService
|
||||
{
|
||||
public int deleteunit(int[] ids);
|
||||
public MdUnitPageDTO GetList(string name, string code, int pageNum, int pageSize);
|
||||
public List<MdUnit> GetList(SearchOptionDTO searchOption);
|
||||
public MdUnit GetUnitbyPK(int measure);
|
||||
public int InsertUnit(MdUnit jo);
|
||||
public int Updateunit(MdUnit paramss);
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using ZR.Model.mes.md;
|
||||
using ZR.Model.mes.md.DTO;
|
||||
|
||||
namespace ZR.Service.mes.md.IService;
|
||||
|
||||
public interface IUnitService
|
||||
{
|
||||
|
||||
public UnitPageDTO GetList(int pageNum, int pageSize);
|
||||
}
|
||||
81
ZR.Service/mes/md/MdProductDefineService.cs
Normal file
81
ZR.Service/mes/md/MdProductDefineService.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Extensions;
|
||||
using JinianNet.JNTemplate;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using ZR.Model.mes.md;
|
||||
using ZR.Model.mes.md.DTO;
|
||||
using ZR.Service.mes.md.IService;
|
||||
|
||||
namespace ZR.Service.mes.md
|
||||
{
|
||||
[AppService(ServiceType = typeof(IMdProductDefineService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class MdProductDefineService : BaseService<MdProductDefine>, IMdProductDefineService
|
||||
{
|
||||
public int deleteProductDefine(int[] ids)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public MdProductDefineDTO GetList(string name, string code, int pageNum, int pageSize)
|
||||
{
|
||||
int totalNum = 0;
|
||||
var predicate = Expressionable.Create<MdProductDefine>()
|
||||
.AndIF(name.IsNotEmpty(), pro => pro.ProductName.Contains(name))
|
||||
.AndIF(code.IsNotEmpty(), pro => pro.ProductCode.Contains(code)).ToExpression();
|
||||
|
||||
|
||||
List<MdProductDefine> data = Context.Queryable<MdProductDefine>()
|
||||
.LeftJoin<MdUnit>((pro, unit) => pro.ProductUnit == unit.MeasureId)
|
||||
.Where(predicate)
|
||||
.Select((pro, unit) => new MdProductDefine()
|
||||
{
|
||||
ProductUnitName = unit.MeasureName
|
||||
},
|
||||
true).ToPageList(pageNum, pageSize, ref totalNum);
|
||||
|
||||
|
||||
MdProductDefineDTO productPageDto = new MdProductDefineDTO();
|
||||
productPageDto.list = data;
|
||||
productPageDto.Total = totalNum;
|
||||
return productPageDto;
|
||||
|
||||
}
|
||||
|
||||
public List<MdUnit> GetList(SearchOptionDTO searchOption)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public MdUnit GetProductDefinebyPK(int measure)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<MdUnit> GetProductDefineList(string name)
|
||||
{
|
||||
return Context.Queryable<MdUnit>().Where(it=>it.MeasureName.Contains(name)).ToList();
|
||||
}
|
||||
|
||||
public List<MdUnit> GetProductDefineList()
|
||||
{
|
||||
return Context.Queryable<MdUnit>().ToList();
|
||||
}
|
||||
|
||||
public int InsertProductDefine(MdUnit jo)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public int UpdateProductDefine(MdUnit paramss)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
74
ZR.Service/mes/md/MdUnitService.cs
Normal file
74
ZR.Service/mes/md/MdUnitService.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System.Collections.Generic;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Extensions;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
using ZR.Model.mes.md;
|
||||
using ZR.Model.mes.md.DTO;
|
||||
using ZR.Model.System;
|
||||
using ZR.Service.mes.md.IService;
|
||||
using ZR.Service.System.IService;
|
||||
using NotImplementedException = System.NotImplementedException;
|
||||
|
||||
namespace ZR.Service.mes.md;
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IMdUnitService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class MdUnitService : BaseService<MdUnit>, IMdUnitService
|
||||
{
|
||||
public int deleteunit(int[] ids)
|
||||
{
|
||||
return Delete(ids);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取列表
|
||||
/// </summary>
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
public MdUnitPageDTO GetList(string name,string code,int pageNum,int pageSize)
|
||||
{
|
||||
int totalNum = 0;
|
||||
var predicate = Expressionable.Create<MdUnit>()
|
||||
.AndIF(name.IsNotEmpty(),it=>it.MeasureName.Contains(name))
|
||||
.AndIF(code.IsNotEmpty(),it=>it.MeasureCode.Contains(code)).ToExpression();
|
||||
|
||||
|
||||
List<MdUnit> data = Context.Queryable<MdUnit>().Where(predicate).ToPageList(pageNum, pageSize, ref totalNum);
|
||||
MdUnitPageDTO unitPageDto = new MdUnitPageDTO();
|
||||
unitPageDto.list = data;
|
||||
unitPageDto.Total = totalNum;
|
||||
return unitPageDto ;
|
||||
}
|
||||
|
||||
public List<MdUnit> GetList(SearchOptionDTO searchOption)
|
||||
{
|
||||
var predicate = Expressionable.Create<MdUnit>()
|
||||
.AndIF(searchOption.starttime.IsNotEmpty(), it => it.CreatedTime >= searchOption.starttime)
|
||||
.AndIF(searchOption.endtime.IsNotEmpty(), it => it.CreatedTime <= searchOption.endtime)
|
||||
.AndIF(searchOption.measureCode.IsNotEmpty(), it => it.MeasureCode.Contains(searchOption.measureCode))
|
||||
.AndIF(searchOption.measureName.IsNotEmpty(), it => it.MeasureCode.Contains(searchOption.measureName))
|
||||
.ToExpression();
|
||||
return Context.Queryable<MdUnit>().Where(predicate).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取单条unit
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public MdUnit GetUnitbyPK(int id)
|
||||
{
|
||||
return GetId(id);
|
||||
}
|
||||
|
||||
public int InsertUnit(MdUnit jo)
|
||||
{
|
||||
return Insert(jo);
|
||||
}
|
||||
|
||||
public int Updateunit(MdUnit jo) => Update(jo,false);
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Infrastructure.Attribute;
|
||||
using SqlSugar;
|
||||
using ZR.Model.mes.md;
|
||||
using ZR.Model.mes.md.DTO;
|
||||
using ZR.Model.System;
|
||||
using ZR.Service.mes.md.IService;
|
||||
using ZR.Service.System.IService;
|
||||
using NotImplementedException = System.NotImplementedException;
|
||||
|
||||
namespace ZR.Service.mes.md;
|
||||
|
||||
/// <summary>
|
||||
/// 文件管理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IUnitService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class UnitService : BaseService<Unit>, IUnitService
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取列表
|
||||
/// </summary>
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
public UnitPageDTO GetList(int pageNum,int pageSize)
|
||||
{
|
||||
int totalNum = 0;
|
||||
List<Unit> data = Context.Queryable<Unit>().ToPageList(pageNum, pageSize, ref totalNum);
|
||||
UnitPageDTO unitPageDto = new UnitPageDTO();
|
||||
unitPageDto.list = data;
|
||||
unitPageDto.Total = totalNum;
|
||||
return unitPageDto ;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user