Пример #1
0
        public JsonResult LoadCarByCarNo(string strCarNo)
        {
            string strErrText;
            DDSystem dd = new DDSystem();
            CarrierCar data = dd.LoadCarByCarNo(strCarNo, LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                return Json(null, JsonRequestBehavior.AllowGet);
            }
            else
            {
                var ret = new
                {
                    TrailerNo = data.TrailerNo,
                    CarryingCapacity = data.CarryingCapacity
                };

                return Json(ret, JsonRequestBehavior.AllowGet);
            }
        }
Пример #2
0
        public ActionResult DispatchPaperPlan(string id)
        {
            string strErrText;

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

            //如果是配送
            if (deliverPlan.ReceiveType == InnoSoft.LS.Resources.Options.PickUpDelivery)
            {
                //创建Model
                DispatchBillViewModel model = new DispatchBillViewModel();
                model.CreateTime = DateTime.Now.ToString("yyyy-MM-dd");

                model.DeliverPlans = new List<DispatchBillDeliverPlanViewModel>();
                DispatchBillDeliverPlanViewModel modelDeliverPlan = new DispatchBillDeliverPlanViewModel();
                modelDeliverPlan.PlanId = deliverPlan.Id;
                model.DeliverPlans.Add(modelDeliverPlan);

                return View(model);
            }
            //如果是自提
            else
            {
                //创建Model
                DispatchBillViewModel model = new DispatchBillViewModel();
                model.CreateTime = DateTime.Now.ToString("yyyy-MM-dd");

                //读取车号是否已有调度单
                DispatchSystem dispatch = new DispatchSystem();
                DispatchBill dispatchBill = dispatch.LoadSubmitDispatchBillByCarNo(deliverPlan.CarNo, LoginAccountId, LoginStaffName, out strErrText);
                if (dispatchBill != null)
                {
                    model.CarNo = dispatchBill.CarNo;
                    model.TrailerNo = dispatchBill.TrailerNo;
                    model.DriverName = dispatchBill.DriverName;
                    model.DriverLicenseNo = dispatchBill.DriverLicenseNo;
                    model.DriverMobileTel = dispatchBill.DriverMobileTel;
                    model.DriverHomeTel = dispatchBill.DriverHomeTel;
                    model.CarrierId = dispatchBill.CarrierId;
                    model.CarrierName = dispatchBill.CarrierName;
                    model.CarryingCapacity = dispatchBill.CarryingCapacity;

                    //读取承运单位信息
                    DDSystem dd = new DDSystem();
                    Carrier carrier = dd.LoadCarrier(dispatchBill.CarrierId, LoginAccountId, LoginStaffName, out strErrText);
                    if (carrier != null)
                    {
                        model.BusinessType = carrier.BusinessType;
                        model.PaymentType = carrier.PaymentType;
                    }
                }
                else
                {
                    model.CarNo = deliverPlan.CarNo;
                    model.TrailerNo = deliverPlan.TrailerNo;
                    model.DriverName = deliverPlan.DriverName;
                    model.DriverLicenseNo = deliverPlan.DriverLicenseNo;
                    model.DriverMobileTel = deliverPlan.DriverMobileTel;
                    model.DriverHomeTel = deliverPlan.DriverHomeTel;
                    model.CarrierId = deliverPlan.CarrierId;
                    model.CarrierName = deliverPlan.CarrierName;

                    //读取车辆载重
                    DDSystem dd = new DDSystem();
                    CarrierCar car = dd.LoadCarByCarNo(deliverPlan.CarNo, LoginAccountId, LoginStaffName, out strErrText);
                    if (car != null)
                    {
                        model.CarryingCapacity = car.CarryingCapacity;
                    }

                    //读取承运单位信息
                    Carrier carrier = dd.LoadCarrierByCarNo(deliverPlan.CarNo, LoginAccountId, LoginStaffName, out strErrText);
                    if (carrier != null)
                    {
                        model.CarrierId = carrier.Id;
                        model.CarrierName = carrier.Name;
                        model.BusinessType = carrier.BusinessType;
                        model.PaymentType = carrier.PaymentType;
                    }
                }

                model.DeliverPlans = new List<DispatchBillDeliverPlanViewModel>();
                DispatchBillDeliverPlanViewModel modelDeliverPlan = new DispatchBillDeliverPlanViewModel();
                modelDeliverPlan.PlanId = deliverPlan.Id;
                model.DeliverPlans.Add(modelDeliverPlan);

                return View(model);
            }
        }