|
|
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.IRepositories;
|
|
|
using Estsh.Core.Dapper;
|
|
|
using System.Collections;
|
|
|
using Estsh.Core.Model.ExcelModel;
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:库存明细查询
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Services
|
|
|
{
|
|
|
public class StockDetailQueryService : BaseService<SysStock>, IStockDetailQueryService
|
|
|
{
|
|
|
|
|
|
private readonly IStockDetailQueryRepository repository;
|
|
|
|
|
|
public StockDetailQueryService(IStockDetailQueryRepository _repository) : base(_repository)
|
|
|
{
|
|
|
repository = _repository;
|
|
|
}
|
|
|
|
|
|
public Hashtable getZoneList(string zoneName, string enabled, int factoryId, Pager pager, String direction, String sort)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
|
|
|
String strWhere = " 1=1 and carton_type='0' ";
|
|
|
|
|
|
if (zoneName != null && !zoneName.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += "and zone_name like '%" + zoneName.Trim() + "%' ";
|
|
|
}
|
|
|
|
|
|
if (enabled != null && !enabled.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += "and enabled = '" + enabled + "' ";
|
|
|
}
|
|
|
strWhere += " and factory_id = " + factoryId + " and zone_id != '' and warehouse_id !='' and locate_id != '' ";
|
|
|
|
|
|
String orderBy = "";
|
|
|
if (sort != null && !"".Equals(sort.Trim()))
|
|
|
{
|
|
|
orderBy += typeof(SysZone).GetEntityColumnName(sort.Trim()) + " " + direction;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
orderBy += typeof(SysZone).GetEntityColumnName("zoneId") + " " + direction;
|
|
|
}
|
|
|
|
|
|
result = repository.getZoneList(pager.pageSize, pager.pageNo, strWhere, orderBy);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public List<SysStock> getLocateListByPage(string zoneName, string locateName, string enabled, int factoryId)
|
|
|
{
|
|
|
String strWhere = " 1=1 and carton_type='0' ";
|
|
|
if (zoneName != null && !zoneName.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += "and zone_name like '%" + zoneName.Trim() + "%' ";
|
|
|
}
|
|
|
if (locateName != null && !locateName.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += "and locate_name like '%" + locateName.Trim() + "%' ";
|
|
|
}
|
|
|
if (enabled != null && !enabled.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += " and enabled = '" + enabled.Trim() + "' ";
|
|
|
}
|
|
|
|
|
|
strWhere += " and factory_id = " + factoryId + " and zone_id != '' and warehouse_id !='' and locate_id != '' ";
|
|
|
|
|
|
|
|
|
List<SysStock> dt = repository.getLocateListByPage(strWhere);
|
|
|
return dt;
|
|
|
}
|
|
|
|
|
|
public List<KeyValueResult> GetStockType()
|
|
|
{
|
|
|
return repository.GetStockType();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据分页条件获取分页菜单数据
|
|
|
/// </summary>
|
|
|
/// <param name="partNo_search"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <returns></returns>
|
|
|
public List<SysStock> getDPSListByPage(string zoneName, string locateName, string cartonNo, string partNo, string partSpec, string enabled, int factoryId,string stockType)
|
|
|
{
|
|
|
String strWhere = " 1=1 and carton_type='0' ";
|
|
|
if (zoneName != null && !zoneName.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += "and a.zone_name like '%" + zoneName.Trim() + "%' ";
|
|
|
}
|
|
|
if (locateName != null && !locateName.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += "and a.locate_name like '%" + locateName.Trim() + "%' ";
|
|
|
}
|
|
|
if (cartonNo != null && !cartonNo.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += "and a.carton_no like '%" + cartonNo.Trim() + "%' ";
|
|
|
}
|
|
|
if (partNo != null && !partNo.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += "and a.part_no like '%" + partNo.Trim() + "%' ";
|
|
|
}
|
|
|
if (partSpec != null && !partSpec.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += "and a.part_spec like '%" + partSpec.Trim() + "%' ";
|
|
|
}
|
|
|
if (enabled != null && !enabled.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += " and a.enabled = '" + enabled.Trim() + "' ";
|
|
|
}
|
|
|
if (stockType != null && !stockType.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += " and a.status = '" + stockType.Trim() + "' ";
|
|
|
}
|
|
|
|
|
|
strWhere += " and a.factory_id = " + factoryId + " and a.zone_id != '' and a.warehouse_id !='' and a.locate_id != '' ";
|
|
|
|
|
|
return repository.getListByPage(strWhere);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取零件号
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public List<KeyValueResult> GetPartNo()
|
|
|
{
|
|
|
return repository.GetPartNo();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取库位名称
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public List<KeyValueResult> GetLocateName()
|
|
|
{
|
|
|
return repository.GetLocateName();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取枚举值
|
|
|
/// </summary>
|
|
|
/// <param name="enumtype">枚举类型</param>
|
|
|
/// <returns></returns>
|
|
|
public List<KeyValueResult> GetSysEnum(string enumtype)
|
|
|
{
|
|
|
return repository.GetSysEnum(enumtype);
|
|
|
|
|
|
}
|
|
|
public List<KeyValueResult> GetWareHouseName()
|
|
|
{
|
|
|
return repository.GetWareHouseName();
|
|
|
}
|
|
|
public List<StockDetailQuery> getExportList(string zoneName, string locateName, string cartonNo, string partNo, string partSpec, string enabled, string factoryId,string stockType)
|
|
|
{
|
|
|
String strWhere = " 1=1 and carton_type='0' ";
|
|
|
if (zoneName != null && !zoneName.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += "and a.zone_name like '%" + zoneName.Trim() + "%' ";
|
|
|
}
|
|
|
|
|
|
if (locateName != null && !locateName.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += "and a.locate_name like '%" + locateName.Trim() + "%' ";
|
|
|
}
|
|
|
if (cartonNo != null && !cartonNo.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += "and a.carton_no like '%" + cartonNo.Trim() + "%' ";
|
|
|
}
|
|
|
if (partNo != null && !partNo.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += "and a.part_no like '%" + partNo.Trim() + "%' ";
|
|
|
}
|
|
|
if (partSpec != null && !partSpec.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += "and a.part_spec like '%" + partSpec.Trim() + "%' ";
|
|
|
}
|
|
|
if (enabled != null && !enabled.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += " and a.enabled = '" + enabled.Trim() + "' ";
|
|
|
}
|
|
|
if (stockType != null && !stockType.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += " and a.status = '" + stockType.Trim() + "' ";
|
|
|
}
|
|
|
|
|
|
strWhere += " and a.factory_id = " + factoryId + " and zone_id != '' and warehouse_id !='' and locate_id != '' ";
|
|
|
|
|
|
List<StockDetailQuery> dt = repository.getExportList(strWhere);
|
|
|
return dt;
|
|
|
}
|
|
|
//解冻
|
|
|
public int EnableData(string ids, string empId)
|
|
|
{
|
|
|
ids = ids.Substring(0, ids.Length - 1);
|
|
|
return repository.EnableData(ids, empId);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
} |