47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
using Infrastructure.Attribute;
|
|
using SqlSugar;
|
|
using ZR.Model.mes.md;
|
|
using ZR.Service.mes.md.IService;
|
|
|
|
namespace ZR.Service.mes.md
|
|
{
|
|
[AppService(ServiceType = typeof(IMdDeviceService), ServiceLifetime = LifeTime.Transient)]
|
|
public class MdDeviceService : BaseService<MdDevice>, IMdDeviceService
|
|
{
|
|
public int AddDevice(MdDevice workshop)
|
|
{
|
|
|
|
return Insert(workshop);
|
|
}
|
|
|
|
public int deleteDevice(int[] ids)
|
|
{
|
|
return Delete(ids);
|
|
}
|
|
|
|
|
|
|
|
public (int, List<MdDevice>) GetAll(string deviceCode, string deviceName, int pageNum, int pageSize)
|
|
{
|
|
int totalNum = 0;
|
|
var predicate = Expressionable.Create<MdDevice>()
|
|
.AndIF(!string.IsNullOrEmpty(deviceCode), it => it.DeviceCode.Contains(deviceCode))
|
|
.AndIF(!string.IsNullOrEmpty(deviceName), it => it.DeviceName.Contains(deviceName))
|
|
.ToExpression();
|
|
List<MdDevice> data = Context.Queryable<MdDevice>().Includes(x => x.Workstation).Where(predicate).ToPageList(pageNum, pageSize, ref totalNum);
|
|
return (totalNum, data);
|
|
}
|
|
|
|
public int UpdateDevice(MdDevice workshop)
|
|
{
|
|
return Update(workshop, true);
|
|
}
|
|
|
|
|
|
public List<MdWorkstation> getworkstationList()
|
|
{
|
|
return Context.Queryable<MdWorkstation>().ToList();
|
|
}
|
|
}
|
|
}
|