Exemple #1
0
        public ActionResult NewPaperPlan(PaperPlanViewModel model)
        {
            if (ModelState.IsValid)
            {
                //检查数据
                if (model.ReceiveType == InnoSoft.LS.Resources.Options.PickUpSelf)
                {
                    //自提必须输入车号
                    if (model.CarNo == null || model.CarNo == string.Empty)
                    {
                        return Json(InnoSoft.LS.Resources.Strings.NotEnterCarrierInfoWhenPickUpSelf);
                    }
                    if (model.DriverName != null && model.DriverName != string.Empty)
                    {
                        if (model.DriverLicenseNo == null || model.DriverLicenseNo == string.Empty)
                        {
                            return Json(InnoSoft.LS.Resources.Strings.NotEnterDriverLicenseNo);
                        }
                        if (model.DriverMobileTel == null || model.DriverMobileTel == string.Empty)
                        {
                            return Json(InnoSoft.LS.Resources.Strings.NotEnterDriverMobileTel);
                        }
                    }
                }
                else
                {
                    if (model.DeliveryNo == null || model.DeliveryNo == string.Empty)
                    {
                        return Json(InnoSoft.LS.Resources.Strings.NotEnterDeliveryNo);
                    }
                }
                if (model.Goods == null || model.Goods.Count == 0)
                {
                    return Json(InnoSoft.LS.Resources.Strings.NotEnterGoods);
                }

                //创建数据
                DeliverPlan data = new DeliverPlan();
                data.PlanType = InnoSoft.LS.Resources.Options.PaperPlan;
                data.CustomerId = model.CustomerId;
                data.CustomerName = model.CustomerName;
                data.ShipmentNo = model.ShipmentNo;
                data.DeliveryNo = model.DeliveryNo;
                data.DeliverType = model.DeliverType;
                data.ReceiverName = model.ReceiverName;
                data.ReceiverCountry = model.ReceiverCountry;
                data.ReceiverProvince = model.ReceiverProvince;
                data.ReceiverCity = model.ReceiverCity;
                data.ReceiverAddress = model.ReceiverAddress;
                data.ReceiverContact = model.ReceiverContact;
                data.ReceiverContactTel = model.ReceiverContactTel;
                data.OrderNo = model.OrderNo;
                data.ReceiveType = model.ReceiveType;
                data.CarNo = model.CarNo;
                data.TrailerNo = model.TrailerNo;
                data.DriverName = model.DriverName;
                data.DriverLicenseNo = model.DriverLicenseNo;
                data.DriverMobileTel = model.DriverMobileTel;
                data.DriverHomeTel = model.DriverHomeTel;
                data.Warehouse = model.Warehouse;
                data.ArrivalTime = model.ArrivalTime;
                data.PayerId = model.PayerId;
                data.PayerName = model.PayerName;
                data.IsConsigning = model.IsConsigning;
                data.ConsignedDeliveryNo = model.ConsignedDeliveryNo;
                data.IsInstalment = model.IsInstalment;
                data.StartCountry = model.StartCountry;
                data.StartProvince = model.StartProvince;
                data.StartCity = model.StartCity;
                data.Remark = model.Remark;
                data.CreateTime = DateTime.Parse(model.CreateTime);

                List<DeliverPlanGoods> listGoods = new List<DeliverPlanGoods>();
                if (model.Goods != null)
                {
                    foreach (PaperPlanGoodsViewModel m in model.Goods)
                    {
                        DeliverPlanGoods g = new DeliverPlanGoods();
                        g.GoodsId = m.GoodsId;
                        g.BatchNo = m.BatchNo;
                        g.Packing = m.Packing;
                        g.Location = m.Location;
                        g.Packages = m.Packages;
                        g.PieceWeight = m.PieceWeight;
                        g.Tunnages = m.Tunnages;
                        g.Piles = 0;
                        g.TenThousands = 0;
                        g.ProductionDate = m.ProductionDate;
                        g.EnterWarehouseBillId = m.EnterWarehouseBillId;
                        listGoods.Add(g);
                    }
                }

                //保存数据
                string strErrText;
                PlanSystem plan = new PlanSystem();
                if (plan.InsertDeliverPlan(data, listGoods, LoginAccountId, LoginStaffName, out strErrText) > 0)
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }
Exemple #2
0
        public ActionResult NewPaperPlan()
        {
            string strErrText;

            //创建空的Model
            PaperPlanViewModel model = new PaperPlanViewModel();
            model.CreateTime = DateTime.Now.ToString("yyyy-MM-dd");

            model.Goods = new List<PaperPlanGoodsViewModel>();
            model.Goods.Add(new PaperPlanGoodsViewModel());

            //生成国家下拉列表项
            DDSystem dd = new DDSystem();
            List<Country> listCountry = dd.LoadCountrys(LoginAccountId, LoginStaffName, out strErrText);
            if (listCountry == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListCountry = new List<SelectListItem>();
            selectListCountry.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListCountry.AddRange(from c in listCountry
                                       select new SelectListItem
                                       {
                                           Text = c.Name,
                                           Value = c.Name
                                       });
            ViewData["Countrys"] = new SelectList(selectListCountry, "Value", "Text");

            //生成空的省份下拉列表项
            List<Province> listState = new List<Province>();
            List<SelectListItem> selectListState = new List<SelectListItem>();
            selectListState.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListState.AddRange(from s in listState
                                     select new SelectListItem
                                     {
                                         Text = s.Name,
                                         Value = s.Name
                                     });
            ViewData["Provinces"] = new SelectList(selectListState, "Value", "Text");

            //生成空的城市下拉列表项
            List<City> listCity = new List<City>();
            List<SelectListItem> selectListCity = new List<SelectListItem>();
            selectListCity.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListCity.AddRange(from ci in listCity
                                    select new SelectListItem
                                    {
                                        Text = ci.Name,
                                        Value = ci.Name
                                    });
            ViewData["Citys"] = new SelectList(selectListCity, "Value", "Text");

            return View(model);
        }
Exemple #3
0
        public ActionResult ModifyPaperPlan(string id)
        {
            string strErrText;

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

            //创建Model
            PaperPlanViewModel model = new PaperPlanViewModel();
            model.Id = data.Id;
            model.CustomerId = data.CustomerId;
            model.CustomerName = data.CustomerName;
            model.ShipmentNo = data.ShipmentNo;
            model.DeliveryNo = data.DeliveryNo;
            model.DeliverType = data.DeliverType;
            model.ReceiverName = data.ReceiverName;
            model.ReceiverCountry = data.ReceiverCountry;
            model.ReceiverProvince = data.ReceiverProvince;
            model.ReceiverCity = data.ReceiverCity;
            model.ReceiverAddress = data.ReceiverAddress;
            model.ReceiverContact = data.ReceiverContact;
            model.ReceiverContactTel = data.ReceiverContactTel;
            model.OrderNo = data.OrderNo;
            model.ReceiveType = data.ReceiveType;
            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.ArrivalTime = data.ArrivalTime;
            model.PayerId = data.PayerId;
            model.PayerName = data.PayerName;
            model.IsConsigning = data.IsConsigning;
            model.ConsignedDeliveryNo = data.ConsignedDeliveryNo;
            model.IsInstalment = data.IsInstalment;
            model.StartCountry = data.StartCountry;
            model.StartProvince = data.StartProvince;
            model.StartCity = data.StartCity;
            model.Remark = data.Remark;
            model.CreateTime = data.CreateTime.ToString("yyyy-MM-dd");

            model.Goods = new List<PaperPlanGoodsViewModel>();
            model.Goods.Add(new PaperPlanGoodsViewModel());

            //生成讫点国家下拉列表项
            DDSystem dd = new DDSystem();
            List<Country> listDestCountry = dd.LoadCountrys(LoginAccountId, LoginStaffName, out strErrText);
            if (listDestCountry == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListDestCountry = new List<SelectListItem>();
            selectListDestCountry.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListDestCountry.AddRange(from c in listDestCountry
                                           select new SelectListItem
                                           {
                                               Text = c.Name,
                                               Value = c.Name
                                           });
            ViewData["DestCountrys"] = new SelectList(selectListDestCountry, "Value", "Text", model.ReceiverCountry);

            //生成讫点省份下拉列表项
            List<Province> listDestProvince = null;
            if (!string.IsNullOrEmpty(model.ReceiverCountry))
            {
                listDestProvince = dd.LoadProvincesByCountry(model.ReceiverCountry, LoginAccountId, LoginStaffName, out strErrText);
                if (listDestProvince == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listDestProvince = new List<Province>();
            }
            List<SelectListItem> selectListDestProvince = new List<SelectListItem>();
            selectListDestProvince.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListDestProvince.AddRange(from p in listDestProvince
                                            select new SelectListItem
                                            {
                                                Text = p.Name,
                                                Value = p.Name
                                            });
            ViewData["DestProvinces"] = new SelectList(selectListDestProvince, "Value", "Text", model.ReceiverProvince);

            //生成讫点城市下拉列表项
            List<City> listDestCity = null;
            if (!string.IsNullOrEmpty(model.ReceiverProvince))
            {
                listDestCity = dd.LoadCitysByProvince(model.ReceiverCountry, model.ReceiverProvince, LoginAccountId, LoginStaffName, out strErrText);
                if (listDestCity == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listDestCity = new List<City>();
            }
            List<SelectListItem> selectListDestCity = new List<SelectListItem>();
            selectListDestCity.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListDestCity.AddRange(from ci in listDestCity
                                        select new SelectListItem
                                        {
                                            Text = ci.Name,
                                            Value = ci.Name
                                        });
            ViewData["DestCitys"] = new SelectList(selectListDestCity, "Value", "Text", model.ReceiverCity);

            //生成起点国家下拉列表项
            List<Country> listStartCountry = dd.LoadCountrys(LoginAccountId, LoginStaffName, out strErrText);
            if (listStartCountry == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListStartCountry = new List<SelectListItem>();
            selectListStartCountry.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListStartCountry.AddRange(from c in listStartCountry
                                            select new SelectListItem
                                            {
                                                Text = c.Name,
                                                Value = c.Name
                                            });
            ViewData["StartCountrys"] = new SelectList(selectListStartCountry, "Value", "Text", model.StartCountry);

            //生成起点省份下拉列表项
            List<Province> listStartProvince = null;
            if (!string.IsNullOrEmpty(model.StartCountry))
            {
                listStartProvince = dd.LoadProvincesByCountry(model.StartCountry, LoginAccountId, LoginStaffName, out strErrText);
                if (listStartProvince == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listStartProvince = new List<Province>();
            }
            List<SelectListItem> selectListStartProvince = new List<SelectListItem>();
            selectListStartProvince.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListStartProvince.AddRange(from p in listStartProvince
                                             select new SelectListItem
                                             {
                                                 Text = p.Name,
                                                 Value = p.Name
                                             });
            ViewData["StartProvinces"] = new SelectList(selectListStartProvince, "Value", "Text", model.StartProvince);

            //生成起点城市下拉列表项
            List<City> listStartCity = null;
            if (!string.IsNullOrEmpty(model.StartProvince))
            {
                listStartCity = dd.LoadCitysByProvince(model.StartCountry, model.StartProvince, LoginAccountId, LoginStaffName, out strErrText);
                if (listStartCity == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listStartCity = new List<City>();
            }
            List<SelectListItem> selectListStartCity = new List<SelectListItem>();
            selectListStartCity.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListStartCity.AddRange(from ci in listStartCity
                                         select new SelectListItem
                                         {
                                             Text = ci.Name,
                                             Value = ci.Name
                                         });
            ViewData["StartCitys"] = new SelectList(selectListStartCity, "Value", "Text", model.StartCity);

            return View(model);
        }
Exemple #4
0
        public ActionResult CustomerNewPaperPlan()
        {
            string strErrText;

            //创建空的Model
            PaperPlanViewModel model = new PaperPlanViewModel();
            model.CreateTime = DateTime.Now.ToString("yyyy-MM-dd");

            model.Goods = new List<PaperPlanGoodsViewModel>();
            model.Goods.Add(new PaperPlanGoodsViewModel());

            //设置客户信息和付款单位信息
            if (LoginAccountType == InnoSoft.LS.Resources.Options.Customer)
            {
                model.CustomerId = LoginOrganId;
                model.CustomerName = LoginOrganName;
                model.PayerId = model.CustomerId;
                model.PayerName = model.CustomerName;

                //读取客户所属办事处数据
                CustomerSystem customer = new CustomerSystem();
                Customer dataCustomer = customer.LoadCustomer(model.CustomerId, LoginAccountId, LoginStaffName, out strErrText);
                if (dataCustomer == null)
                {
                    throw new Exception(strErrText);
                }
                OrganizationSystem organ = new OrganizationSystem();
                Organization dataOrgan = organ.LoadOrganization(dataCustomer.OwnOrganId, LoginAccountId, LoginStaffName, out strErrText);
                if (dataOrgan == null)
                {
                    throw new Exception(strErrText);
                }
                model.StartCountry = dataOrgan.CountryName;
                model.StartProvince = dataOrgan.ProvinceName;
                model.StartCity = dataOrgan.CityName;
            }

            //生成讫点国家下拉列表项
            DDSystem dd = new DDSystem();
            List<Country> listDestCountry = dd.LoadCountrys(LoginAccountId, LoginStaffName, out strErrText);
            if (listDestCountry == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListDestCountry = new List<SelectListItem>();
            selectListDestCountry.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListDestCountry.AddRange(from c in listDestCountry
                                           select new SelectListItem
                                           {
                                               Text = c.Name,
                                               Value = c.Name
                                           });
            ViewData["DestCountrys"] = new SelectList(selectListDestCountry, "Value", "Text");

            //生成空的讫点省份下拉列表项
            List<Province> listDestProvince = new List<Province>();
            List<SelectListItem> selectListDestProvince = new List<SelectListItem>();
            selectListDestProvince.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListDestProvince.AddRange(from s in listDestProvince
                                            select new SelectListItem
                                            {
                                                Text = s.Name,
                                                Value = s.Name
                                            });
            ViewData["DestProvinces"] = new SelectList(selectListDestProvince, "Value", "Text");

            //生成空的讫点城市下拉列表项
            List<City> listDestCity = new List<City>();
            List<SelectListItem> selectListDestCity = new List<SelectListItem>();
            selectListDestCity.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListDestCity.AddRange(from ci in listDestCity
                                        select new SelectListItem
                                        {
                                            Text = ci.Name,
                                            Value = ci.Name
                                        });
            ViewData["DestCitys"] = new SelectList(selectListDestCity, "Value", "Text");

            //生成起点国家下拉列表项
            List<Country> listStartCountry = dd.LoadCountrys(LoginAccountId, LoginStaffName, out strErrText);
            if (listStartCountry == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListStartCountry = new List<SelectListItem>();
            selectListStartCountry.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListStartCountry.AddRange(from c in listStartCountry
                                            select new SelectListItem
                                            {
                                                Text = c.Name,
                                                Value = c.Name
                                            });
            ViewData["StartCountrys"] = new SelectList(selectListStartCountry, "Value", "Text", model.StartCountry);

            //生成起点省份下拉列表项
            List<Province> listStartProvince = null;
            if (!string.IsNullOrEmpty(model.StartCountry))
            {
                listStartProvince = dd.LoadProvincesByCountry(model.StartCountry, LoginAccountId, LoginStaffName, out strErrText);
                if (listStartProvince == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listStartProvince = new List<Province>();
            }
            List<SelectListItem> selectListStartProvince = new List<SelectListItem>();
            selectListStartProvince.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListStartProvince.AddRange(from p in listStartProvince
                                             select new SelectListItem
                                             {
                                                 Text = p.Name,
                                                 Value = p.Name
                                             });
            ViewData["StartProvinces"] = new SelectList(selectListStartProvince, "Value", "Text", model.StartProvince);

            //生成起点城市下拉列表项
            List<City> listStartCity = null;
            if (!string.IsNullOrEmpty(model.StartProvince))
            {
                listStartCity = dd.LoadCitysByProvince(model.StartCountry, model.StartProvince, LoginAccountId, LoginStaffName, out strErrText);
                if (listStartCity == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                listStartCity = new List<City>();
            }
            List<SelectListItem> selectListStartCity = new List<SelectListItem>();
            selectListStartCity.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListStartCity.AddRange(from ci in listStartCity
                                         select new SelectListItem
                                         {
                                             Text = ci.Name,
                                             Value = ci.Name
                                         });
            ViewData["StartCitys"] = new SelectList(selectListStartCity, "Value", "Text", model.StartCity);

            return View(model);
        }
Exemple #5
0
        public ActionResult LoadPaperPlanDetails(string id)
        {
            string strErrText;

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

            //创建Model
            PaperPlanViewModel model = new PaperPlanViewModel();
            model.Id = data.Id;
            model.CustomerId = data.CustomerId;
            model.CustomerName = data.CustomerName;
            model.ShipmentNo = data.ShipmentNo;
            model.DeliveryNo = data.DeliveryNo;
            model.DeliverType = data.DeliverType;
            model.ReceiverName = data.ReceiverName;
            model.ReceiverCountry = data.ReceiverCountry;
            model.ReceiverProvince = data.ReceiverProvince;
            model.ReceiverCity = data.ReceiverCity;
            model.ReceiverAddress = data.ReceiverAddress;
            model.ReceiverContact = data.ReceiverContact;
            model.ReceiverContactTel = data.ReceiverContactTel;
            model.OrderNo = data.OrderNo;
            model.ReceiveType = data.ReceiveType;
            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.Warehouse = data.Warehouse;
            model.ArrivalTime = data.ArrivalTime;
            model.PayerId = data.PayerId;
            model.PayerName = data.PayerName;
            model.IsConsigning = data.IsConsigning;
            model.ConsignedDeliveryNo = data.ConsignedDeliveryNo;
            model.IsInstalment = data.IsInstalment;
            model.StartCountry = data.StartCountry;
            model.StartProvince = data.StartProvince;
            model.StartCity = data.StartCity;
            model.Remark = data.Remark;
            model.CreateTime = data.CreateTime.ToString("yyyy-MM-dd");

            return PartialView("PaperPlanDetails", model);
        }