/// <summary> /// CS版 检查入库 add by huhaiyou 2014-4-23 /// </summary> /// <returns></returns> public InStorageWayBillModel CheckOnInStorageCS(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 = _inStorageService.GetWayBillInfo(NumberStr, filter.CustomerCode); //.ToModel<WayBillInfoModel>(); if (!string.IsNullOrWhiteSpace(NumberStr) && waybillinfo != null) { //if (!string.IsNullOrWhiteSpace(filter.TrackingNumber) && waybillinfo.TrackingNumber != filter.TrackingNumber) //{ // error.AppendLine("跟踪号与输入的跟踪号不一样!<br/>"); //}_orderService.AddAbnormalWayBill 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) { 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 = _customerService.GetCustomer(waybillinfo.CustomerCode); if (customer != null) { customerId = customer.CustomerID; } var result = _freightService.GetCustomerShippingPrice(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.CanShipping) { model.IsSuccess = true; model.Message = ""; model.WayBillNumber = waybillinfo.WayBillNumber; model.CountryCode = waybillinfo.CountryCode; model.CountryName = _freightService.GetChineseName(waybillinfo.CountryCode); model.CustomerOrderNumber = waybillinfo.CustomerOrderNumber; model.Freight = result.ShippingFee; //运费 model.FuelCharge = result.FuelFee; //燃油费 model.Register = result.RegistrationFee; //挂号费 model.Surcharge = result.RemoteAreaFee + result.OtherFee; //附加费 model.SettleWeight = result.Weight; //结算重量 //if (!string.IsNullOrWhiteSpace(filter.TrackingNumber) && // filter.TrackingNumber != waybillinfo.TrackingNumber) //{ // model.TrackingNumber = filter.TrackingNumber; //} //else //{ // model.TrackingNumber = !string.IsNullOrWhiteSpace(waybillinfo.TrackingNumber) ? waybillinfo.TrackingNumber : ""; //} model.TrackingNumber = !string.IsNullOrWhiteSpace(waybillinfo.TrackingNumber) ? waybillinfo.TrackingNumber : ""; //if (filter.ChkPrint) //{ // var customerOrder = GetPrinterInfo(waybillinfo.CustomerOrderID); // if (customerOrder != null) // { // var wayBillTemplateModel = _wayBillTemplateService.GetWayBillTemplateByNameAndShippingMethod(filter.PrintTemplateName, filter.ShippingMethodId).FirstOrDefault(); // if (wayBillTemplateModel != null) // { // //model.HtmlString = this.RenderPartialViewToString("_PrintTNTOrder", customerOrderInfosModels); // if (!string.IsNullOrWhiteSpace(customerOrder.TrackingNumber)) // { // model.HtmlString = // System.Web.WebPages.Razor.Parse(HttpUtility.HtmlDecode(wayBillTemplateModel.TemplateContent), // customerOrder); // } // } // } //} } else { // _orderService.AddAbnormalWayBill(waybillinfo.WayBillNumber, WayBill.AbnormalTypeEnum.InAbnormal, result.Message); //入仓扫描时取消因重量价格不对自动拦截运单 by:bookers date:2013.10.25 model.IsSuccess = false; model.Message = result.Message; } } } else { model.IsSuccess = false; model.Message = string.Format("单号:{0}系统找不到!", NumberStr); } return(model); }