using System.Collections; using Estsh.Core.Util; using Estsh.Core.Repository.IRepositories; using Estsh.Core.Services.IServices; using Estsh.Core.Models; using Estsh.Core.Model.Result; using Estsh.Core.IRepositories; using Estsh.Core.Dapper; /*************************************************************************************************** * * 更新人:sitong.dong * 描述:库位管理 * 修改时间:2022.06.22 * 修改日志:系统迭代升级 * **************************************************************************************************/ namespace Estsh.Core.Services { public class PurchaseManageService : BaseService, IPurchaseManageService { private readonly IPurchaseManageRepository repository; public PurchaseManageService(IPurchaseManageRepository _repository) : base(_repository) { repository = _repository; } public Hashtable getPurchaseListByPage(string orderNo, string orderType,string orderStatus, string startTime, string endTime, string enabled, int factoryId, Pager pager, String direction, String sort) { Hashtable result = new Hashtable(); String strWhere = " 1=1 "; if (orderNo != null && !orderNo.Trim().Equals("")) { strWhere += "and a.order_no like '%" + orderNo.Trim() + "%' "; } if (orderType != null && !orderType.Trim().Equals("")) { strWhere += "and a.order_type ='" + orderType.Trim() + "' "; } if (orderStatus != null && !orderStatus.Trim().Equals("")) { strWhere += "and a.order_status ='" + orderStatus.Trim() + "' "; } if (!String.IsNullOrEmpty(startTime) && !String.IsNullOrEmpty(endTime)) { strWhere += " and a.create_time BETWEEN '" + startTime.Trim() + "' AND '" + endTime.Trim() + "'"; } else if (String.IsNullOrEmpty(startTime) && !String.IsNullOrEmpty(endTime)) { strWhere += " and a.create_time < '" + endTime.Trim() + "'"; } else if (!String.IsNullOrEmpty(startTime) && String.IsNullOrEmpty(endTime)) { strWhere += " and a.create_time >'" + startTime.Trim() + "'"; } if (enabled != null && !enabled.Trim().Equals("")) { strWhere += "and a.enabled = '" + enabled.Trim() + "' "; } strWhere += " and a.factory_id = " + factoryId + " "; String orderBy = ""; if (sort != null && !"".Equals(sort.Trim())) { orderBy += typeof(WmsPurchase).GetEntityColumnName(sort.Trim()) + " " + direction; } else { orderBy += typeof(WmsPurchase).GetEntityColumnName("orderNo") + " " + direction; } return repository.getPurchaseListByPage(pager.pageSize, pager.pageNo, strWhere, orderBy); } public Hashtable getPurchaseDetailListByPage(string orderNo, string enabled, int factoryId) { Hashtable result = new Hashtable(); String strWhere = " 1=1 "; if (orderNo != null && !orderNo.Trim().Equals("")) { strWhere += "and a.order_no like '%" + orderNo.Trim() + "%' "; } if (enabled != null && !enabled.Trim().Equals("")) { strWhere += "and a.enabled = '" + enabled.Trim() + "' "; } strWhere += " and a.factory_id = " + factoryId + " "; return repository.getPurchaseDetailListByPage(strWhere); } public Hashtable getStockListByPage(string orderNo, string partNo, string enabled, int factoryId) { Hashtable result = new Hashtable(); String strWhere = " 1=1 "; if (orderNo != null && !orderNo.Trim().Equals("")) { strWhere += "and a.ref_order_no like '%" + orderNo.Trim() + "%'"; } if (partNo != null && !partNo.Trim().Equals("")) { strWhere += "and a.part_no = '" + partNo.Trim() + "'"; } if (enabled != null && !enabled.Trim().Equals("")) { strWhere += "and a.enabled = '" + enabled.Trim() + "'"; } strWhere += " and a.factory_id = " + factoryId + " "; return repository.getStockListByPage(strWhere); } public List getStockListByPrint(string orderNo, string enabled, int factoryId) { Hashtable result = new Hashtable(); String strWhere = " 1=1 "; if (orderNo != null && !orderNo.Trim().Equals("")) { strWhere += "and a.ref_order_no like '%" + orderNo.Trim() + "%'"; } if (enabled != null && !enabled.Trim().Equals("")) { strWhere += "and a.enabled = '" + enabled.Trim() + "'"; } strWhere += " and a.factory_id = " + factoryId + " "; return repository.getStockListByPrint(strWhere); } public List GetPartInfo(string part_no) { return repository.GetPartInfo(part_no); } public List GetErpwarehouse() { return repository.GetErpwarehouse(); } public List GetOrderStatus() { return repository.GetOrderStatus(); } public List getSelectFactory() { return repository.getSelectFactory(); } public List getSelectWarehouse() { return repository.getSelectWarehouse(); } public List getSelectWarehouse(string warehouseid) { return repository.getSelectWarehouse(warehouseid); } public List getSelectZone(string zoneid) { return repository.getSelectZone(zoneid); } public List getSelectZone() { return repository.getSelectZone(); } public List getSelectVendor() { return repository.getSelectVendor(); } public List getSelectVendor(string vendorName) { return repository.getSelectVendor(vendorName); } public List GetPart() { return repository.GetPart(0); } public List GetPart(string PartNo) { return repository.GetPart(0, PartNo); } public List GetOrderType() { return repository.GetOrderType(); } /// /// 保存菜单数据 /// /// /// public int savePurchaseManage(WmsPurchase htParams, IList htDetailParams) { return repository.savePurchaseManage(htParams, htDetailParams); } public List GetPartNoInfo(string part_no) { return this.repository.GetPartNoInfo(part_no); } public List GetPartNoInfoByPartNo(string part_no) { return this.repository.GetPartNoInfoByPartNo(part_no); } public List GetPartSpecInfo(string partSpec) { return this.repository.GetPartSpecInfo(partSpec); } public List GetPartSpecInfoByPartSpec(string partSpec) { return this.repository.GetPartSpecInfoByPartSpec(partSpec); } /// /// 查看菜单详情 /// /// /// public Hashtable getWarehouseDetail(String warehouse_id) { warehouse_id = " warehouse_id = " + warehouse_id; List dt = repository.getList(warehouse_id, ""); Hashtable result = new Hashtable(); result.Add("warehouseId", dt[0].WarehouseId); result.Add("factoryId", dt[0].FactoryId); result.Add("factoryName", dt[0].FactoryName); result.Add("warehouseName", dt[0].WarehouseName); result.Add("warehouseDesc", dt[0].WarehouseDesc); result.Add("enabled", dt[0].Enabled); return result; } public Hashtable onBarcodeGenerator(string orderNo, string userID, string factoryID, string factoryCode) { orderNo = orderNo.Substring(0, orderNo.Length - 1); return this.repository.onBarcodeGenerator(orderNo, userID, factoryID, factoryCode); } /// /// 关闭 /// /// /// public int onClose(String ids) { ids = ids.Substring(0, ids.Length - 1); return this.repository.onClose(ids); } /// /// 启用 /// /// /// public int EnableData(String ids) { ids = ids.Substring(0, ids.Length - 1); return this.repository.EnableData(ids); } /// /// 禁用 /// /// /// public int DisableData(String ids) { ids = ids.Substring(0, ids.Length - 1); return this.repository.DisableData(ids); } } }