123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- using SqlSugar;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using WMS.Core.APPBLL;
- using WMS.Info;
- using WMS.Util;
- namespace WMS.Core.ServiceCore
- {
- public class WcsDeviceprotocolService
- {
- /// <summary>
- /// 获取分页数据
- /// <summary>
- /// <returns></returns>
- public IEnumerable<dynamic> GetPageList(Pagination pagination, string queryJson)
- {
- SqlSugarClient client = null;
- try
- {
- client = WCSDbCore.GetDbCtx();
- int count = 0;
- var queryParam = queryJson.ToJObject();
- var db = client.Queryable<WcsDeviceprotocolEntity>();
- if (!queryParam["keyword"].IsEmpty())
- {
- string kw = queryParam["keyword"].ToString();
- db.Where(ord => ord.Devicecode.Contains(kw));
- }
- if (pagination.sord.ToUpper() != "ASC")
- {
- pagination.sidx = pagination.sidx + " DESC";
- }
- var list = db.OrderBy(pagination.sidx).Select<dynamic>(@"*").ToPageList(pagination.page, pagination.rows, ref count);
- pagination.records = count;
- return list;
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- client.Dispose();
- }
- }
- /// <summary>
- /// 获取数据
- /// <summary>
- /// <returns></returns>
- public IEnumerable<WcsDeviceprotocolEntity> GetListByDevicecode(string Devicecode)
- {
- var client = WCSDbCore.GetDbCtx();
- var db = client.Queryable<WcsDeviceprotocolEntity>();
- var lists = db.Where(o => o.Devicecode == Devicecode).ToList();
- return lists;
- }
- /// <summary>
- /// 获取实体数据
- /// <param name="id">主键</param>
- /// <summary>
- /// <returns></returns>
- public WcsDeviceprotocolEntity GetEntity(int id)
- {
- return WCSDbCore.GetDbCtx().Queryable<WcsDeviceprotocolEntity>().Where(it => it.Id == id).First();
- }
- /// <summary>
- /// 获取实体数据
- /// <param name="Devicecode"></param>
- /// <summary>
- /// <returns></returns>
- public IEnumerable<WcsDeviceprotocolEntity> GetEntityByDevicecode(string Devicecode)
- {
- return WCSDbCore.GetDbCtx().Queryable<WcsDeviceprotocolEntity>().Where(it => it.Devicecode == Devicecode).ToList();
- }
- /// <summary>
- /// 删除实体数据
- /// <param name="id">主键</param>
- /// <summary>
- /// <returns></returns>
- public void DeleteEntity(int id)
- {
- WCSDbCore.GetDbCtx().Deleteable<WcsDeviceprotocolEntity>().Where(it => it.Id == id).ExecuteCommand();
- }
- /// <summary>
- /// 删除数据
- /// <param name="Devicecode">主键</param>
- /// <summary>
- /// <returns></returns>
- public void DeleteByDevicecode(string Devicecode)
- {
- WCSDbCore.GetDbCtx().Deleteable<WcsDeviceprotocolEntity>().Where(it => it.Devicecode == Devicecode).ExecuteCommand();
- }
- }
- }
|