1
yangpeixing
2026-03-13 c84eb83d59f5d3057a6f3dbc375d3c98a6447c2f
WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs
@@ -20,6 +20,7 @@
using WIDESEA_Core.CodeConfigEnum;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
using WIDESEA_Core.Log;
using WIDESEA_Core.Utilities;
using WIDESEA_DTO;
using WIDESEA_DTO.Basic;
@@ -110,7 +111,7 @@
                    {
                        string serialNumber = serialNumberObj?.ToString();
                        if (!string.IsNullOrEmpty(serialNumber))
                        {
                        {
                            serialNumbers.Add(serialNumber);
                        }
                        else
@@ -322,7 +323,7 @@
                decimal totalQuantity = stockInfo.Details.Sum(x => x.StockQuantity);
                inboundOrder.OrderStatus = InOrderStatusEnum.入库中.ObjToInt();
                _unitOfWorkManage.BeginTran();
                if (stockInfo.Id == 0)
                {
@@ -469,7 +470,8 @@
                    Dt_InboundOrderDetail notGroupDetail = new Dt_InboundOrderDetail();
                    notGroupDetail = inboundOrder.Details.Where(x => x.OrderDetailStatus <= OrderDetailStatusEnum.Inbounding.ObjToInt() && x.MaterielCode == model.MaterielCode && x.BatchNo == model.LotNo).FirstOrDefault();
                    notGroupDetail = inboundOrder.Details.Where(x => x.OrderDetailStatus <= OrderDetailStatusEnum.Inbounding.ObjToInt() && x.MaterielCode == model.MaterielCode && x.BatchNo == model.LotNo && x.OrderQuantity > x.ReceiptQuantity).FirstOrDefault();
                    if (notGroupDetail.MaterielType == 1)
                    {
                        stockInfo.WarehouseId = 6;
@@ -743,6 +745,8 @@
                            QtyOfpcs = item.QtyOfpcs,
                            QtyOfxout = item.QtyOfxout,
                            CPStockDetailStatus = (int)StockStatusEmun.组盘暂存,
                            LPNNO = item.LPNNO,
                            OrinalLocation = item.OrinalLocation,
                            Creater = "上游WMS",
                        };
                        stockInfoDetailCP.Add(stockInfoDetailCP1);
@@ -1136,6 +1140,7 @@
        #endregion
        public string ReceiveWMSTaskin = WIDESEA_Core.Helper.AppSettings.Configuration["ReceiveWMSTaskin"];
        /// <summary>
        /// 组盘合托
        /// </summary>
@@ -1295,7 +1300,7 @@
        public int GetPalletType(Dt_Warehouse warehouse, string palletCode)
        {
            if (warehouse.WarehouseCode == WarehouseEnum.SC01_BC.ObjToString())
            if (warehouse.WarehouseCode.Contains("BC"))
            {
                Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 3));
                if (palletTypeInfo == null)
@@ -1313,35 +1318,7 @@
                }
                return palletTypeInfo.PalletType;
            }
            //else if (warehouse.WarehouseCode == WarehouseEnum.HA152.ObjToString())
            //{
            //    Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 2));
            //    if (palletTypeInfo == null)
            //    {
            //        throw new Exception($"托盘号错误");
            //    }
            //    return palletTypeInfo.PalletType;
            //}
            //else if (warehouse.WarehouseCode == WarehouseEnum.HA57.ObjToString())
            //{
            //    Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 3));
            //    if (palletTypeInfo == null)
            //    {
            //        throw new Exception($"托盘号错误");
            //    }
            //    return palletTypeInfo.PalletType;
            //}
            //else if (warehouse.WarehouseCode == WarehouseEnum.HA58.ObjToString())
            //{
            //    Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 2));
            //    if (palletTypeInfo == null)
            //    {
            //        throw new Exception($"托盘号错误");
            //    }
            //    return palletTypeInfo.PalletType;
            //}
            return -1;
            return 0;
        }
        /// <summary>
        /// 判断正确时间格式
@@ -1415,10 +1392,6 @@
                    }
                    if (warehouse.WarehouseCode.Contains("CP"))
                    {
                        if (item.SupplierBatch == null)
                        {
                            return content.Error("供应商批次不可为空");
                        }
                        Dt_InboundOrder inboundOrderOld = BaseDal.Db.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == model.AsnNo).Includes(x => x.Details).First();
                        if (inboundOrderOld != null)
@@ -1450,6 +1423,8 @@
                                        QtyOfpcs = (float)list.QtyOfpcs,
                                        QtyOfxout = (float)list.QtyOfxout,
                                        CPOrderDetailStatus = OrderDetailStatusEnum.New.ObjToInt(),
                                        LPNNO = list.LPNNO,
                                        OrinalLocation = list.OrinalLocation,
                                        Creater = "上游WMS",
                                    };
                                    cPInboundOrderDetail.Add(cPInboundOrderDetail1);
@@ -1492,6 +1467,8 @@
                                    QtyOfpcs = (float)list.QtyOfpcs,
                                    QtyOfxout = (float)list.QtyOfxout,
                                    CPOrderDetailStatus = OrderDetailStatusEnum.New.ObjToInt(),
                                    LPNNO = list.LPNNO,
                                    OrinalLocation = list.OrinalLocation,
                                    Creater = "上游WMS",
                                };
                                cPInboundOrderDetail.Add(cPInboundOrderDetail1);
@@ -1514,7 +1491,6 @@
                                OrinalLocation = item.OrinalLocation,
                                CPDetails = cPInboundOrderDetail
                            };
                            Dt_InboundOrder inboundOrder = new Dt_InboundOrder()
                            {
                                OrderNo = model.AsnNo,
@@ -1552,10 +1528,10 @@
                    }
                    else
                    {
                        if (item.SupplierBatch == null)
                        {
                            return content.Error("供应商批次不可为空");
                        }
                        //if (item.SupplierBatch == null)
                        //{
                        //    return content.Error("供应商批次不可为空");
                        //}
                        Dt_InboundOrder inboundOrderOld = BaseDal.Db.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == model.AsnNo).Includes(x => x.Details).First();
                        if (inboundOrderOld != null)
@@ -1579,7 +1555,7 @@
                                {
                                    OrderId = orderDetail1.OrderId,
                                    MaterielCode = item.MaterielCode,
                                    MaterielType=item.MaterielType,
                                    MaterielType = item.MaterielType,
                                    BatchNo = item.BatchNo,
                                    OrderQuantity = item.OrderQuantity,
                                    ReceiptQuantity = 0,
@@ -1751,6 +1727,7 @@
                    _inboundOrderDetailService.DeleteData(item);
                }
                BaseDal.DeleteData(oldOutboundOrder);
                WriteLog.Write_Log("API", "SMOM推送入库单据取消", "请求成功", new { 请求报文 = oldOutboundOrder, 接收报文 = content });
                content = WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
@@ -1775,11 +1752,11 @@
                List<Dt_InboundOrder> dt_ReceiveOrders = new List<Dt_InboundOrder>();
                if (string.IsNullOrEmpty(orderNo))
                {
                    dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderStatus < InboundStatusEnum.入库完成.ObjToInt() && x.WarehouseId == warehouseId).Includes(x => x.Details).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 10);
                    dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderStatus < InboundStatusEnum.入库完成.ObjToInt() && x.WarehouseId == warehouseId).Includes(x => x.Details).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 50);
                }
                else
                {
                    dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => (x.OrderNo.Contains(orderNo)) && x.OrderStatus < InboundStatusEnum.入库完成.ObjToInt() && x.WarehouseId == warehouseId).Includes(x => x.Details).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 10);
                    dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => (x.OrderNo.Contains(orderNo)) && x.OrderStatus < InboundStatusEnum.入库完成.ObjToInt() && x.WarehouseId == warehouseId).Includes(x => x.Details).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 50);
                }
                content.OK(data: dt_ReceiveOrders);
@@ -1843,7 +1820,10 @@
                };
                _unitOfWorkManage.BeginTran();
                Db.InsertNav(erpProScrapSheet).Include(x => x.Details).ExecuteCommand();
                WriteLog.Write_Log("API", "erp单据下发", "请求成功", new { 请求报文 = erpProScrapSheet, 接收报文 = WebResponseContent.Instance.OK() });
                _unitOfWorkManage.CommitTran();
                return WebResponseContent.Instance.OK();
            }
@@ -1942,7 +1922,7 @@
        }
        //反拣回库单
        public WebResponseContent ReceiveReturnOrder(List<HouseReturnOrder> houseReturnOrder)
       {
        {
            try
            {
                Random random = new Random();