Пример #1
0
        public JsonResult LoadContractDispatchBill(string dispatchBillId)
        {
            string strErrText;

            //读取调度单数据
            DispatchSystem dispatch = new DispatchSystem();
            DispatchBill bill = dispatch.LoadDispatchBill(long.Parse(dispatchBillId), LoginAccountId, LoginStaffName, out strErrText);
            if (bill == null)
            {
                throw new Exception(strErrText);
            }

            //读取调度计划数据
            List<DispatchBillDeliverPlan> listDeliverPlan = dispatch.LoadDispatchBillDeliverPlans(long.Parse(dispatchBillId), LoginAccountId, LoginStaffName, out strErrText);
            if (listDeliverPlan == null)
            {
                throw new Exception(strErrText);
            }

            //读取调度货物数据
            List<DispatchBillGoods> listGoods = dispatch.LoadDispatchBillAllGoods(long.Parse(dispatchBillId), LoginAccountId, LoginStaffName, out strErrText);
            if (listGoods == null)
            {
                throw new Exception(strErrText);
            }

            //清除自提的计划
            foreach (DispatchBillDeliverPlan p in listDeliverPlan)
            {
                if (p.ReceiveType == InnoSoft.LS.Resources.Options.PickUpSelf)
                {
                    listGoods.RemoveAll(delegate(DispatchBillGoods g) { return g.PlanId == p.PlanId; });
                }
            }
            listDeliverPlan.RemoveAll(delegate(DispatchBillDeliverPlan p) { return p.ReceiveType == InnoSoft.LS.Resources.Options.PickUpSelf; });

            //生成结果集
            var ret = new
            {
                CarNo = bill.CarNo,
                TrailerNo = bill.TrailerNo,
                CarType = bill.CarType,
                DriverName = bill.DriverName,
                DriverLicenseNo = bill.DriverLicenseNo,
                DriverMobileTel = bill.DriverMobileTel,
                DriverHomeTel = bill.DriverHomeTel,
                CarrierId = bill.CarrierId,
                CarrierName = bill.CarrierName,
                GoodsName = (from g in listGoods select g.GoodsName).Distinct(),
                Packing = "",
                TotalPackages = listDeliverPlan.Sum(p => p.Packages),
                TotalTunnages = listDeliverPlan.Sum(p => p.Tunnages).ToString("#0.######"),
                TotalPiles = listDeliverPlan.Sum(p => p.Piles).ToString("#0.######"),
                TotalTenThousands = listDeliverPlan.Sum(p => p.TenThousands).ToString("#0.######"),
                StartPlace = (from p in listDeliverPlan select p.StartCity).Distinct(),
                DestPlace = (from p in listDeliverPlan select p.ReceiverCity).Distinct(),
                ShipmentTime = DateTime.Now.ToString("yyyy-MM-dd"),
                ArrivalTime = "",
                TotalTransportCharges = listDeliverPlan.Sum(p => p.TransportCharges).ToString("#0.00"),
                PrepayTransportCharges = "",
                ResidualTransportCharges = listDeliverPlan.Sum(p => p.TransportCharges).ToString("#0.00"),
                OriginalContractNo = ""
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Пример #2
0
        public ActionResult ModifyDeliverBill(string id)
        {
            string strErrText;

            //读取送货单数据
            DeliverSystem deliver = new DeliverSystem();
            DeliverBill deliverBill = deliver.LoadDeliverBill(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
            if (deliverBill == null)
            {
                throw new Exception(strErrText);
            }

            //读取发货计划数据
            PlanSystem plan = new PlanSystem();
            DeliverPlan deliverPlan = plan.LoadDeliverPlan(deliverBill.PlanId, LoginAccountId, LoginStaffName, out strErrText);
            if (deliverPlan == null)
            {
                throw new Exception(strErrText);
            }

            //读取调度数据
            DispatchSystem dispatch = new DispatchSystem();
            DispatchBill dispatchBill = dispatch.LoadDispatchBill(deliverBill.DispatchBillId, LoginAccountId, LoginStaffName, out strErrText);
            if (dispatchBill == null)
            {
                throw new Exception(strErrText);
            }

            DispatchBillDeliverPlan dispatchBillDeliverPlan = dispatch.LoadDispatchBillDeliverPlan(deliverBill.DispatchBillId, deliverBill.PlanId, LoginAccountId, LoginStaffName, out strErrText);
            if (dispatchBillDeliverPlan == null)
            {
                throw new Exception(strErrText);
            }

            //读取协议价格
            DDSystem dd = new DDSystem();
            CarrierTransportPrice price = dd.LoadCarrierTransportPrice(dispatchBill.CarrierId, deliverPlan.StartCountry, deliverPlan.StartProvince, deliverPlan.StartCity, deliverPlan.ReceiverCountry, deliverPlan.ReceiverProvince, deliverPlan.ReceiverCity, deliverPlan.PlanType, deliverPlan.CreateTime, LoginAccountId, LoginStaffName, out strErrText);
            if (price == null)
            {
                throw new Exception(string.Format(InnoSoft.LS.Resources.Strings.LoadCarrierTransportPriceFaild, dispatchBill.CarrierName, deliverPlan.StartProvince + deliverPlan.StartCity, deliverPlan.ReceiverProvince + deliverPlan.ReceiverCity, deliverPlan.PlanType));
            }

            //生成Model
            DeliverBillViewModel model = new DeliverBillViewModel();
            model.TransportChargeExpression = dispatchBillDeliverPlan.TransportChargeExpression;
            model.TransportPriceExpression = dispatchBillDeliverPlan.TransportPriceExpression;
            model.AgreementTransportPrice = price.TransportPrice;
            model.ActualTransportPrice = dispatchBillDeliverPlan.TransportPrice;
            model.TransportCharges = dispatchBillDeliverPlan.TransportCharges;

            //缓存送货单编码和发货计划编码
            ViewData["DeliverBillId"] = id;
            ViewData["CustomerId"] = deliverBill.CustomerId;
            ViewData["PlanId"] = deliverBill.PlanId;
            ViewData["ConsignedDeliveryNo"] = deliverPlan.ConsignedDeliveryNo;

            return View(model);
        }
Пример #3
0
        public ActionResult ModifyShipmentBill(string id)
        {
            string strErrText;

            //读取出仓单数据
            DeliverSystem deliver = new DeliverSystem();
            ShipmentBill shipmentBill = deliver.LoadShipmentBill(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
            if (shipmentBill == null)
            {
                throw new Exception(strErrText);
            }

            //读取发货计划数据
            PlanSystem plan = new PlanSystem();
            DeliverPlan deliverPlan = plan.LoadDeliverPlan(shipmentBill.PlanId, LoginAccountId, LoginStaffName, out strErrText);
            if (deliverPlan == null)
            {
                throw new Exception(strErrText);
            }

            //生成Model
            ShipmentBillViewModel model = new ShipmentBillViewModel();
            if (shipmentBill.OutType == InnoSoft.LS.Resources.Options.DeliverGoods)
            {
                //读取调度数据
                DispatchSystem dispatch = new DispatchSystem();
                DispatchBill dispatchBill = dispatch.LoadDispatchBill(shipmentBill.DispatchBillId, LoginAccountId, LoginStaffName, out strErrText);
                if (dispatchBill == null)
                {
                    throw new Exception(strErrText);
                }

                DispatchBillDeliverPlan dispatchBillDeliverPlan = dispatch.LoadDispatchBillDeliverPlan(shipmentBill.DispatchBillId, shipmentBill.PlanId, LoginAccountId, LoginStaffName, out strErrText);
                if (dispatchBillDeliverPlan == null)
                {
                    throw new Exception(strErrText);
                }

                //读取协议价格
                decimal decAgreementTransportPrice = 0;
                DDSystem dd = new DDSystem();
                CarrierTransportPrice price = dd.LoadCarrierTransportPrice(dispatchBill.CarrierId, deliverPlan.StartCountry, deliverPlan.StartProvince, deliverPlan.StartCity, deliverPlan.ReceiverCountry, deliverPlan.ReceiverProvince, deliverPlan.ReceiverCity, deliverPlan.PlanType, deliverPlan.CreateTime, LoginAccountId, LoginStaffName, out strErrText);
                if (price != null)
                {
                    decAgreementTransportPrice = price.TransportPrice;
                }

                model.TransportChargeExpression = dispatchBillDeliverPlan.TransportChargeExpression;
                model.TransportPriceExpression = dispatchBillDeliverPlan.TransportPriceExpression;
                model.AgreementTransportPrice = decAgreementTransportPrice;
                model.ActualTransportPrice = dispatchBillDeliverPlan.TransportPrice;
                model.TransportCharges = dispatchBillDeliverPlan.TransportCharges;
            }

            //缓存出仓单编码和发货计划编码
            ViewData["ShipmentBillId"] = id;
            ViewData["CustomerId"] = shipmentBill.CustomerId;
            ViewData["PlanId"] = shipmentBill.PlanId;
            ViewData["ConsignedDeliveryNo"] = deliverPlan.ConsignedDeliveryNo;

            return View(model);
        }
Пример #4
0
        public ActionResult SubmitDispatchBill(string id)
        {
            string strErrText;

            //读取调度单数据
            DispatchSystem dispatch = new DispatchSystem();
            DispatchBill data = dispatch.LoadDispatchBill(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                throw new Exception(strErrText);
            }

            //创建Model
            DispatchBillViewModel model = new DispatchBillViewModel();
            model.Id = data.Id;
            model.CarNo = data.CarNo;
            model.TrailerNo = data.TrailerNo;
            model.DriverName = data.DriverName;
            model.DriverLicenseNo = data.DriverLicenseNo;
            model.DriverMobileTel = data.DriverMobileTel;
            model.DriverHomeTel = data.DriverHomeTel;
            model.CarrierId = data.CarrierId;
            model.CarrierName = data.CarrierName;
            model.CarryingCapacity = data.CarryingCapacity;
            model.BusinessType = data.BusinessType;
            model.PaymentType = data.PaymentType;
            model.CreateTime = data.CreateTime.ToString("yyyy-MM-dd");

            return View(model);
        }