using System.Collections;
using Estsh.Core.Models;
using Estsh.Core.Repository.IRepositories;
using Estsh.Core.Util;
using Estsh.Core.Services.IServices;
using Estsh.Core.Model.Result;
using Estsh.Core.Dapper;
/***************************************************************************************************
*
* 更新人:sitong.dong
* 描述:收货查询补打模块业务处理类
* 修改时间:2022.06.22
* 修改日志:系统迭代升级
*
**************************************************************************************************/
namespace Estsh.Core.Services
{
///
/// 收货查询补打模块管理业务处理类
///
public class StockBarcodePrintService : BaseService, IStockBarcodePrintService
{
private readonly IStockBarcodePrintRepository repository;
public StockBarcodePrintService(IStockBarcodePrintRepository _repository) : base(_repository)
{
repository = _repository;
}
#region 收货查询补打
///
/// 根据分页条件获取列表
///
///
///
///
///
///
public Hashtable getListByPage(string cartonNo,string refOrderNo, string status, string lotno, string locateId, string zoneId, string beginCreateTime, string endCreateTime, int factoryId, Pager pager, String direction, String sort)
{
Hashtable result = new Hashtable();
String strWhere = " 1=1 ";
if (refOrderNo != null && !refOrderNo.Trim().Equals(""))
{
strWhere += "and a.ref_order_no like '%" + refOrderNo.Trim() + "%' ";
}
if (cartonNo != null && !cartonNo.Trim().Equals(""))
{
strWhere += "and a.carton_no like '%" + cartonNo.Trim() + "%' ";
}
if (status != null && !status.Trim().Equals(""))
{
strWhere += "and a.status = '" + status.Trim() + "' ";
}
if (lotno != null && !lotno.Trim().Equals(""))
{
strWhere += "and a.lot_no like '%" + lotno.Trim() + "%' ";
}
if (locateId != null && !locateId.Trim().Equals(""))
{
strWhere += "and a.locate_id ='" + locateId.Trim() + "' ";
}
if (zoneId != null && !zoneId.Trim().Equals(""))
{
strWhere += "and a.zone_id ='" + zoneId.Trim() + "' ";
}
if ((beginCreateTime != null && !beginCreateTime.Trim().Equals("")) && (endCreateTime != null && !endCreateTime.Trim().Equals("")))
{
strWhere += "and a.create_time between '" + beginCreateTime.Trim() + "' and '" + endCreateTime.Trim() + "' ";
}
if (!String.IsNullOrEmpty(beginCreateTime) && String.IsNullOrEmpty(endCreateTime))
{
strWhere += " and a.create_time > '" + beginCreateTime.Trim() + "'";
}
if (String.IsNullOrEmpty(beginCreateTime) && !String.IsNullOrEmpty(endCreateTime))
{
strWhere += " and a.create_time < '" + endCreateTime.Trim() + "'";
}
strWhere += " and a.factory_id = " + factoryId + " ";
String orderBy = "";
if (sort != null && !"".Equals(sort.Trim()))
{
orderBy += "a." + typeof(SysStock).GetEntityColumnName(sort.Trim()) + " " + direction;
}
else
{
orderBy += "a." + typeof(SysStock).GetEntityColumnName("Ruid") + " " + direction;
}
result = repository.getListByPage(pager.pageSize, pager.pageNo, strWhere, orderBy);
return result;
}
///
/// 获取库位列表
///
///
///
public List getLocateList()
{
return repository.getLocateList();
}
public List getZoneList()
{
return repository.getZoneList();
}
///
/// 打印
///
///
///
public String print(String ids)
{
ids = ids.Substring(0, ids.Length - 1);
List dt = this.repository.getCartonListByRuid(ids);
if (dt == null || dt.Count == 0)
{
return "Fail";
}
else
{
//return Printer.PrintSerialNumber(dt);
return dt.Count.ToString();
}
}
#endregion
}
}