1
dengjunjie
2025-05-28 01030b05f7ea9b14878102718a2004b4f908dcfc
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
@@ -119,5 +120,54 @@
            }
            return (true, "成功", inboundOrderAddDTO);
        }
        public  WebResponseContent GetInboundOrder(InboundOrderGetDTO inboundOrderGetDTO)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                Expression<Func<Dt_InboundOrder, bool>> expressionOrder = x => true;
                if (!string.IsNullOrEmpty(inboundOrderGetDTO.OrderNo))
                {
                    expressionOrder = x => x.OrderNo.Contains(inboundOrderGetDTO.OrderNo);
                }
                int count = BaseDal.QueryData(x => x.OrderStatus == InboundStatusEnum.未开始.ObjToInt()).ToList().Count();
                int maxPage = Convert.ToInt32(Math.Ceiling(count / 10.0));
                if (inboundOrderGetDTO.pageNo <= maxPage)
                {
                    var inboundOrder = BaseDal.Db.Queryable<Dt_InboundOrder>().Where(expressionOrder).OrderByDescending(x => x.CreateDate).Skip((inboundOrderGetDTO.pageNo - 1) * 10).Take(10).Select(x => new Dt_InboundOrder { OrderNo = x.OrderNo, Id = x.Id, CreateDate = x.CreateDate,Creater=x.Creater }).ToList();
                    content = WebResponseContent.Instance.OK(data: inboundOrder);
                }
                else
                {
                    content = WebResponseContent.Instance.OK(data: null, message: "已到最后一页");
                }
            }
            catch (Exception ex)
            {
                content = WebResponseContent.Instance.Error($"查询入库单据错误,错误信息:{ex.Message}");
            }
            return content;
        }
        public WebResponseContent GetInboundOrderDetail(string OrderNo)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                Dt_InboundOrder inboundOrder = BaseDal.QueryFirst(x => x.OrderNo==OrderNo);
                var inboundOrderDetail = BaseDal.Db.Queryable<Dt_InboundOrderDetail>().Where(x=>x.OrderId==inboundOrder.Id).Take(10).Select(x => new Dt_InboundOrderDetail { MaterielCode = x.MaterielCode, MaterielName = x.MaterielName, OrderQuantity = x.OrderQuantity, ReceiptQuantity = x.ReceiptQuantity, OverInQuantity=x.OverInQuantity }).ToList();
                content = WebResponseContent.Instance.OK(data: inboundOrderDetail);
            }
            catch (Exception ex)
            {
                content = WebResponseContent.Instance.Error($"查询入库单据明细错误,错误信息:{ex.Message}");
            }
            return content;
        }
    }
}