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, 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 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 dt = repository.getLocateListByPage(strWhere); return dt; } public List GetStockType() { return repository.GetStockType(); } /// /// 根据分页条件获取分页菜单数据 /// /// /// /// /// /// public List 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); } /// /// 获取零件号 /// /// public List GetPartNo() { return repository.GetPartNo(); } /// /// 获取库位名称 /// /// public List GetLocateName() { return repository.GetLocateName(); } /// /// 获取枚举值 /// /// 枚举类型 /// public List GetSysEnum(string enumtype) { return repository.GetSysEnum(enumtype); } public List GetWareHouseName() { return repository.GetWareHouseName(); } public List 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 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); } } }