123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- using SqlSugar;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using WMS.Info;
- using WMS.Util;
- namespace WMS.Core.ServiceCore
- {
- public class FxInventoryTransactionCore
- {
- /// <summary>
- /// 获取分页数据
- /// <summary>
- /// <returns></returns>
- public IEnumerable<dynamic> GetInventoryPageList(Pagination pagination, string queryJson)
- {
- SqlSugarClient client = null;
- try
- {
- client = SysDbCore.GetDbCtx();
- int count = 0;
- var queryParam = queryJson.ToJObject();
- var db = client.Queryable<BILL_INVENTORYTRANSACTION>();
- //单据日期
- if (!queryParam["Btime"].IsEmpty() && !queryParam["Etime"].IsEmpty())
- {
- db.Where(ord => ord.F_addTime >= queryParam["Btime"].ToDate() && ord.F_addTime <= queryParam["Etime"].ToDate());
- }
- if (!queryParam["keyword"].IsEmpty())
- {
- string matNo = queryParam["keyword"].ToString();
- db.Where(ord => ord.F_matNo.Contains(matNo) || ord.F_matName.Contains(matNo));
- }
- if (!queryParam["F_trayNo"].IsEmpty())
- {
- string trayNo = queryParam["F_trayNo"].ToString();
- db.Where(ord => ord.F_sourceTrayNo.Contains(trayNo) || ord.F_targetTrayNo.Contains(trayNo));
- }
- if (!queryParam["F_boxNo"].IsEmpty())
- {
- string boxNo = queryParam["F_boxNo"].ToString();
- db.Where(ord => ord.F_boxNo.Contains(boxNo));
- }
- if (!queryParam["F_matType"].IsEmpty())
- {
- string matType = queryParam["F_matType"].ToString();
- db.Where(ord => ord.F_matType == FuncStr.NullToInt(matType));
- }
- if (pagination.sord.ToUpper() != "ASC")
- {
- pagination.sidx = pagination.sidx + " DESC";
- }
- // (case when regexp_substr(ord.F_NO,'[^_]+',1,2) is null then ord.F_NO else regexp_substr(ord.F_NO,'[^_]+',1,2) end)
- var list = db.OrderBy(pagination.sidx).Select<BILL_INVENTORYTRANSACTION>(@"
- [F_inventoryNo],
- [F_warehouseNo],
- [F_projectNo],
- [F_matNo],
- [F_matName],
- [F_matType],
- [F_sourceQuantity],
- [F_sourceLockQty],
- [F_targetQuantity],
- [F_targetLockQty],
- [F_sourceTrayNo],
- [F_targetTrayNo],
- [F_batchNo],
- [F_memo],
- [F_isBonded],
- [F_UID],
- [F_addUserNo],
- [F_addTime],
- [F_boxNo],
- [F_productDate]").ToPageList(pagination.page, pagination.rows, ref count);
- pagination.records = count;
- return list;
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- client.Dispose();
- }
- }
- }
- }
|