public SettledPodDistributionToDb(SettlePodDistribution settlePodDistribution) : base(s_metadata) { SetSqlInt64(0, settlePodDistribution.FeePodID); SetSqlString(1, settlePodDistribution.FeeSystemNumber); SetSqlString(2, settlePodDistribution.FeeCustomOrerderNunber); SetSqlString(3, settlePodDistribution.FeeCreator); SetSqlDateTime(4, settlePodDistribution.FeeCreatorTime); SetSqlString(5, settlePodDistribution.FeeStr1); SetSqlString(6, settlePodDistribution.FeeStr2); SetSqlString(7, settlePodDistribution.FeeStr3); SetSqlString(8, settlePodDistribution.FeeStr4); SetSqlString(9, settlePodDistribution.FeeStr5); SetSqlString(10, settlePodDistribution.FeeStr10); SetSqlDecimal(11, settlePodDistribution.FeeDecimal1 ?? 0); SetSqlDecimal(12, settlePodDistribution.FeeDecimal2 ?? 0); SetSqlDecimal(13, settlePodDistribution.FeeDecimal3 ?? 0); SetSqlDecimal(14, settlePodDistribution.FeeDecimal4 ?? 0); SetSqlDecimal(15, settlePodDistribution.FeeDecimal5 ?? 0); SetSqlDecimal(16, settlePodDistribution.FeeDecimal6 ?? 0); SetSqlDecimal(17, settlePodDistribution.FeeDecimal7 ?? 0); SetSqlDecimal(18, settlePodDistribution.FeeDecimal8 ?? 0); SetSqlDecimal(19, settlePodDistribution.FeeDecimal9 ?? 0); SetSqlDecimal(20, settlePodDistribution.FeeDecimal10 ?? 0); SetSqlDecimal(21, settlePodDistribution.FeeDecimal11 ?? 0); SetSqlInt64(22, settlePodDistribution.FeeInt1 ?? 0); }
public ActionResult AuditPod(string PodIDs, string startBatchNumber, string aarriers, string carNumber, double?sumWeight, decimal?deliveryFeeFactory, decimal?deliveryFeeJiatuo, decimal?unloadingCosts, decimal?startFee, decimal?fuelCosts, decimal?packagesFare, int?scores, decimal?pointCharges, decimal?permitFees, decimal?otherCosts, decimal?total, decimal?amountTo, int?carModels, string remarks, string type) { var PodsID = PodIDs.Split(',').Select(id => id.ObjectToInt64()); double Weight = 0; PodService service = new PodService(); var podsResponse = service.QueryPodByPodIDs(new QueryPodByIDsRequest() { PodIDs = PodsID }); if (type == "1") { if (carModels == 3) { foreach (var podweight in podsResponse.Result) { Weight += podweight.Weight == null ? 0 : (double)podweight.Weight; } return(this.Json(Weight)); } else { var podsResponses = podsResponse.Result.GroupBy(p => p.Str6); return(this.Json(podsResponses.Count())); } } string carModel = string.Empty; decimal amountTos = 0; decimal totals = 0; int podCount = PodsID.Count(); double realityWeight = (double)(sumWeight == null ? 0 : sumWeight); IList <SettlePodDistribution> settlePodDistributions = new List <SettlePodDistribution>(); if (carModels == 1 || carModels == 2) { if (carModels == 1) { carModel = "面包车"; } else { carModel = "4.2"; } if (packagesFare != null) { amountTos = (decimal)(packagesFare); } else { amountTos = (decimal)((deliveryFeeFactory == null ? 0 : deliveryFeeFactory) + (deliveryFeeJiatuo == null ? 0 : deliveryFeeJiatuo) + (unloadingCosts == null ? 0 : unloadingCosts) + (startFee == null ? 0 : startFee) + (fuelCosts == null ? 0 : fuelCosts) + (packagesFare == null ? 0 : packagesFare) + (pointCharges == null ? 0 : pointCharges) + (permitFees == null ? 0 : permitFees) + (otherCosts == null ? 0 : otherCosts)); } totals = amountTos / podCount; foreach (var pod in podsResponse.Result) { SettlePodDistribution settlePodDistribution = new SettlePodDistribution() { FeePodID = pod.ID, FeeSystemNumber = pod.SystemNumber, FeeCustomOrerderNunber = pod.CustomerOrderNumber, FeeCreator = pod.Creator, FeeCreatorTime = DateTime.Now, FeeStr1 = startBatchNumber, FeeStr2 = aarriers, FeeStr3 = carNumber, FeeStr4 = pod.Weight.ToString(), FeeStr5 = carModel, FeeStr10 = remarks, FeeDecimal1 = deliveryFeeFactory / podCount, FeeDecimal2 = deliveryFeeJiatuo / podCount, FeeDecimal3 = unloadingCosts / podCount, FeeDecimal4 = fuelCosts / podCount, FeeDecimal5 = packagesFare / podCount, FeeDecimal6 = startFee / podCount, FeeDecimal7 = pointCharges / podCount, FeeDecimal8 = permitFees / podCount, FeeDecimal9 = otherCosts / podCount, FeeDecimal10 = totals, FeeDecimal11 = amountTos, FeeInt1 = scores }; settlePodDistributions.Add(settlePodDistribution); } } else if (carModels == 3) { StringBuilder sb = new StringBuilder(); foreach (var pod in podsResponse.Result) { if (pod.Weight == null || pod.Weight == 0) { sb.Append(pod.CustomerOrderNumber + ","); } } if (sb.Length > 0) { sb.Append("请设置这些运单的重量"); return(this.Json(sb.ToString())); } //if (string.IsNullOrEmpty(sumWeight)) //{ // foreach (var podWeight in podsResponse.Result) // { // Weight+= (double)podWeight.Weight; // } // sumWeight = Weight.ToString(); //} carModel = "7.6"; if (packagesFare != null) { amountTos = (decimal)packagesFare; } else { if (sumWeight < 10000) { sumWeight = 10000; } amountTos = (decimal)((deliveryFeeFactory == null ? 0 : deliveryFeeFactory) + (deliveryFeeJiatuo == null ? 0 : deliveryFeeJiatuo) + (unloadingCosts == null ? 0 : unloadingCosts) + (startFee == null ? 0 : startFee) + (fuelCosts == null ? 0 : fuelCosts) + (packagesFare == null ? 0 : packagesFare) + (decimal)(sumWeight * 70 / 1000) + (permitFees == null ? 0 : permitFees) + (otherCosts == null ? 0 : otherCosts)); } foreach (var pod in podsResponse.Result) { SettlePodDistribution settlePodDistribution = new SettlePodDistribution() { FeePodID = pod.ID, FeeSystemNumber = pod.SystemNumber, FeeCustomOrerderNunber = pod.CustomerOrderNumber, FeeCreator = pod.Creator, FeeCreatorTime = DateTime.Now, FeeStr1 = startBatchNumber, FeeStr2 = aarriers, FeeStr3 = carNumber, FeeStr4 = pod.Weight.ToString(), FeeStr5 = carModel, FeeStr10 = remarks, FeeDecimal1 = deliveryFeeFactory * (decimal)(pod.Weight / realityWeight), FeeDecimal2 = deliveryFeeJiatuo * (decimal)(pod.Weight / realityWeight), FeeDecimal3 = unloadingCosts * (decimal)(pod.Weight / realityWeight), FeeDecimal4 = fuelCosts * (decimal)(pod.Weight / realityWeight), FeeDecimal5 = packagesFare == null ? (decimal)((pod.Weight / realityWeight) * (sumWeight * 0.07)) : packagesFare * (decimal)(pod.Weight / realityWeight), FeeDecimal6 = startFee * (decimal)(pod.Weight / realityWeight), FeeDecimal7 = pointCharges, FeeDecimal8 = permitFees * (decimal)(pod.Weight / realityWeight), FeeDecimal9 = otherCosts * (decimal)(pod.Weight / realityWeight), FeeDecimal10 = amountTos * (decimal)(pod.Weight / realityWeight), FeeDecimal11 = amountTos, FeeInt1 = scores }; settlePodDistributions.Add(settlePodDistribution); } } Response <bool> boll = new DistributionService().SettlePodsDistribution(new SettlePodsDistributionRequest() { SettledPodsDistribution = settlePodDistributions }); return(this.Json(boll.IsSuccess)); }