public InStorageWayBillModel CheckOnInStorageSingele(InStorageFormModel filter)
        {
            var model     = new InStorageWayBillModel();
            var error     = new StringBuilder();
            var NumberStr = string.Empty;

            if (!string.IsNullOrWhiteSpace(filter.WayBillNumber))
            {
                NumberStr = filter.WayBillNumber;
            }
            else
            {
                if (!string.IsNullOrWhiteSpace(filter.TrackingNumber))
                {
                    NumberStr = filter.TrackingNumber;
                }
            }
            var waybillinfo = _wayBillInfoRepository.GetWayBillInfoExtSilm(NumberStr);

            if (!string.IsNullOrWhiteSpace(NumberStr) && waybillinfo != null)
            {
                //if (!string.IsNullOrWhiteSpace(filter.TrackingNumber) && waybillinfo.TrackingNumber != filter.TrackingNumber)
                //{
                //    error.AppendLine("跟踪号与输入的跟踪号不一样!<br/>");
                //}
                if (error.Length == 0 && WayBill.StatusToValue(WayBill.StatusEnum.Submitted) != waybillinfo.Status)
                {
                    error.AppendLine(string.Format("运单:{0}状态不是已提交!<br/>", NumberStr));
                }
                if (error.Length == 0 && waybillinfo.GoodsTypeID != filter.GoodsTypeID)
                {
                    error.AppendLine(string.Format("运单:{0}货物类型不是一致", NumberStr));
                }
                if (error.Length == 0 && waybillinfo.IsHold)
                {
                    error.AppendLine(string.Format("运单:{0}已经Hold!<br/>", NumberStr));
                }
                if (error.Length == 0 && waybillinfo.InShippingMethodID.HasValue &&
                    waybillinfo.InShippingMethodID.Value != filter.ShippingMethodId)
                {
                    error.AppendLine(string.Format("入仓运输方式与运单运输方式:{0}不一致!<br/>", waybillinfo.InShippingMethodName));
                    //_orderService.AddAbnormalWayBill(waybillinfo.WayBillNumber, WayBill.AbnormalTypeEnum.InAbnormal, string.Format("运单号:{0}国家或运输方式异常", waybillinfo.WayBillNumber));
                }
                if (error.Length == 0 && waybillinfo.CustomerCode.ToUpper().Trim() != filter.CustomerCode.ToUpper().Trim())
                {
                    error.AppendLine(string.Format("入仓客户与运单客户:{0}不一致!<br/>", waybillinfo.CustomerCode));
                    //_orderService.AddAbnormalWayBill(waybillinfo.WayBillNumber, WayBill.AbnormalTypeEnum.InAbnormal, string.Format("入仓客户与运单客户:{0}不一致", waybillinfo.CustomerCode.ToUpper()));
                }

                //小包检查重量偏差
                if (error.Length == 0 && !filter.IsBusinessExpress)
                {
                    //该客户该运输方式设置的重量偏差值
                    var weightDeviations = GetWeightDeviations(filter.CustomerCode, filter.ShippingMethodId);

                    //预报重量与称重的偏差
                    var diff = Math.Abs((filter.Weight - waybillinfo.Weight ?? 0) * 1000);

                    if (weightDeviations != 0 && diff > weightDeviations)
                    {
                        string errMessage = string.Format("称重重量与预报重量相差" + diff + "g大于配置的 " + weightDeviations + "g不能入仓!");
                        error.AppendLine(errMessage);

                        //增加运单异常日志
                        _orderService.AddAbnormalWayBill(waybillinfo.WayBillNumber, WayBill.AbnormalTypeEnum.InStorageWeightAbnormal, errMessage, filter.OperatorUserName);

                        if (_orderService.IsExistInStorageWeightAbnormal(waybillinfo.WayBillNumber))
                        {
                            _orderService.UpdateInStorageWeightAbnormal(waybillinfo.WayBillNumber, filter.Weight);
                        }
                        else
                        {
                            //增加入仓对比重量异常单
                            _orderService.AddInStorageWeightAbnormal(new WeightAbnormalLog
                            {
                                CustomerCode    = waybillinfo.CustomerCode,
                                WayBillNumber   = waybillinfo.WayBillNumber,
                                CustomerOrderID = waybillinfo.CustomerOrderID,
                                TrackingNumber  = waybillinfo.TrackingNumber,
                                Length          = filter.Length ?? waybillinfo.Length,
                                Width           = filter.Width ?? waybillinfo.Width,
                                Height          = filter.Height ?? waybillinfo.Height,
                                Weight          = filter.Weight,//称重重量
                                CreatedOn       = DateTime.Now,
                                CreatedBy       = filter.OperatorUserName
                            });
                        }
                    }
                }
                if (error.Length > 0)
                {
                    model.IsSuccess = false;
                    model.Message   = error.ToString();
                }
                else
                {
                    // 根据转换重量转换包裹类型 Add by zhengsong
                    #region
                    var shippingMethod = _freightService.GetShippingMethod(filter.ShippingMethodId);
                    if (shippingMethod != null)
                    {
                        if (shippingMethod.Enabled && shippingMethod.ShippingMethodTypeId == 4)
                        {
                            if (filter.Weight <= shippingMethod.PackageTransformFileWeight)
                            {
                                filter.GoodsTypeID = 2;
                            }
                        }
                    }
                    #endregion

                    Guid     customerId = Guid.Empty;
                    Customer customer   = GetGetCustomerListFromCache().Find(p => p.CustomerCode == waybillinfo.CustomerCode);
                    if (customer != null)
                    {
                        customerId = customer.CustomerID;
                    }

                    //判断是否超周长
                    var result = _freightService.IsOverMaxGirthSingle(new CustomerInfoPackageModel()
                    {
                        CountryCode      = waybillinfo.CountryCode,
                        CustomerTypeId   = filter.CustomerType,
                        Height           = filter.Height ?? 0,
                        Length           = filter.Length ?? 0,
                        ShippingMethodId = filter.ShippingMethodId,
                        Weight           = filter.Weight,
                        Width            = filter.Width ?? 0,
                        ShippingTypeId   = filter.GoodsTypeID,
                        CustomerId       = customerId
                    });

                    //如果没有超周长
                    if (!result.Result)
                    {
                        model.IsSuccess           = true;
                        model.Message             = "";
                        model.WayBillNumber       = waybillinfo.WayBillNumber;
                        model.CountryCode         = waybillinfo.CountryCode;
                        model.CountryName         = _freightService.GetChineseName(waybillinfo.CountryCode);
                        model.CustomerOrderNumber = waybillinfo.CustomerOrderNumber;
                        model.SettleWeight        = Convert.ToDecimal(result.Message); //结算重量
                        model.EnableTariffPrepay  = waybillinfo.EnableTariffPrepay;    //是否启用关税预付服务
                        model.TrackingNumber      = !string.IsNullOrWhiteSpace(waybillinfo.TrackingNumber) ? waybillinfo.TrackingNumber : "";
                    }
                    else
                    {
                        model.IsSuccess = false;
                        model.Message   = result.Message;
                    }
                }
            }
            else
            {
                model.IsSuccess = false;
                model.Message   = string.Format("单号:{0}系统找不到!", NumberStr);
            }
            return(model);
        }