Ejemplo n.º 1
0
        public ActionResult ModifyPaperPlan(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.Id = model.Id;
                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.UpdateDeliverPlan(data, listGoods, LoginAccountId, LoginStaffName, out strErrText))
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }
Ejemplo n.º 2
0
        public ActionResult ModifyOtherPlan(OtherPlanViewModel model)
        {
            if (ModelState.IsValid)
            {
                //检查数据
                if (model.Goods == null || model.Goods.Count == 0)
                {
                    return Json(InnoSoft.LS.Resources.Strings.NotEnterGoods);
                }

                //创建数据
                DeliverPlan data = new DeliverPlan();
                data.Id = model.Id;
                data.PlanType = InnoSoft.LS.Resources.Options.OtherPlan;
                data.CustomerId = model.CustomerId;
                data.CustomerName = model.CustomerName;
                data.DeliveryNo = model.DeliveryNo;
                data.DeliverType = InnoSoft.LS.Resources.Options.DeliverGoods;
                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.ReceiveType = InnoSoft.LS.Resources.Options.PickUpDelivery;
                data.Warehouse = model.Warehouse;
                data.ArrivalTime = model.ArrivalTime;
                data.PayerId = model.CustomerId;
                data.PayerName = model.CustomerName;
                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 (OtherPlanGoodsViewModel m in model.Goods)
                    {
                        DeliverPlanGoods g = new DeliverPlanGoods();
                        g.GoodsId = m.GoodsId;
                        g.Packages = m.Packages;
                        g.Tunnages = m.Tunnages;
                        g.Piles = 0;
                        listGoods.Add(g);
                    }
                }

                //保存数据
                string strErrText;
                PlanSystem plan = new PlanSystem();
                if (plan.UpdateDeliverPlan(data, listGoods, LoginAccountId, LoginStaffName, out strErrText))
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }