Exemple #1
0
 public ActionResult CancelDeliverPlan(string id)
 {
     string strErrText;
     PlanSystem plan = new PlanSystem();
     if (plan.CancelDeliverPlan(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText))
     {
         return Json(string.Empty);
     }
     else
     {
         return Json(strErrText);
     }
 }
Exemple #2
0
        public ActionResult AgreeDeliverPlan(string id)
        {
            string strMessage;
            PlanSystem plan = new PlanSystem();
            bool bSuccess = plan.SubmitDeliverPlan(long.Parse(id), true, "", LoginAccountId, LoginStaffName, out strMessage);

            var ret = new
            {
                Success = bSuccess,
                Message = strMessage
            };
            return Json(ret);
        }
Exemple #3
0
        public ActionResult ApproveOpinion(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);
            }

            ViewData["id"] = id;
            ViewData["PlanType"] = data.PlanType;

            return View();
        }
Exemple #4
0
        public ActionResult CopyDeliverPlan(string id)
        {
            //复制计划
            string strErrText;
            PlanSystem plan = new PlanSystem();
            long nPlanId = plan.CopyDeliverPlan(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
            if (nPlanId == 0)
            {
                throw new Exception(strErrText);
            }

            //读取计划
            DeliverPlan data = plan.LoadDeliverPlan(nPlanId, LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                throw new Exception(strErrText);
            }

            if (data.PlanType == InnoSoft.LS.Resources.Options.PaperPlan)
            {
                return RedirectToAction("ModifyPaperPlan", new { id = nPlanId });
            }
            else if (data.PlanType == InnoSoft.LS.Resources.Options.NotDeliverPaperPlan)
            {
                return RedirectToAction("ModifyNotDeliverPaperPlan", new { id = nPlanId });
            }
            else if (data.PlanType == InnoSoft.LS.Resources.Options.CanPlan)
            {
                return RedirectToAction("ModifyCanPlan", new { id = nPlanId });
            }
            else if (data.PlanType == InnoSoft.LS.Resources.Options.NotDeliverCanPlan)
            {
                return RedirectToAction("ModifyNotDeliverCanPlan", new { id = nPlanId });
            }
            else if (data.PlanType == InnoSoft.LS.Resources.Options.NoodlePlan)
            {
                return RedirectToAction("ModifyNoodlePlan", new { id = nPlanId });
            }
            else
            {
                return RedirectToAction("ModifyOtherPlan", new { id = nPlanId });
            }
        }
Exemple #5
0
        public JsonResult IsCustomerNew(long nPlanId)
        {
            //读取计划数据
            string strErrText;
            PlanSystem plan = new PlanSystem();
            DeliverPlan data = plan.LoadDeliverPlan(nPlanId, LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                throw new Exception(strErrText);
            }

            //读取创建人数据
            AuthenticateSystem auth = new AuthenticateSystem();
            Account data2 = auth.LoadAccount(data.CreatorId, LoginAccountId, LoginStaffName, out strErrText);
            if (data2 == null)
            {
                throw new Exception(strErrText);
            }

            if (data2.AccountType == InnoSoft.LS.Resources.Options.Customer)
                return Json(true, JsonRequestBehavior.AllowGet);
            else
                return Json(false, JsonRequestBehavior.AllowGet);
        }
Exemple #6
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 #7
0
 public ActionResult DisagreeDeliverPlan(string id, string disagreeopinion)
 {
     string strErrText;
     PlanSystem plan = new PlanSystem();
     if (plan.SubmitDeliverPlan(long.Parse(id), false, disagreeopinion, LoginAccountId, LoginStaffName, out strErrText))
     {
         return Json(string.Empty);
     }
     else
     {
         return Json(strErrText);
     }
 }
Exemple #8
0
        public ActionResult NewNotDeliverCanPlan(CanPlanViewModel model)
        {
            if (ModelState.IsValid)
            {
                //检查数据
                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.NotDeliverCanPlan;
                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 = 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.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 (CanPlanGoodsViewModel m in model.Goods)
                    {
                        DeliverPlanGoods g = new DeliverPlanGoods();
                        g.GoodsId = m.GoodsId;
                        g.GoodsNo = m.GoodsNo;
                        g.GoodsName = m.GoodsName;
                        g.SpecModel = m.SpecModel;
                        g.BatchNo = m.BatchNo;
                        g.Warehouse = m.Warehouse;
                        g.Location = m.Location;
                        g.Piles = m.Piles;
                        g.TenThousands = m.TenThousands;
                        g.ProductionDate = m.ProductionDate;
                        g.EnterWarehouseBillId = m.EnterWarehouseBillId;
                        g.EnterWarehouseBillNo = m.EnterWarehouseBillNo;
                        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 #9
0
        public ActionResult NewOtherPlan(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.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.InsertDeliverPlan(data, listGoods, LoginAccountId, LoginStaffName, out strErrText) > 0)
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }
Exemple #10
0
        public JsonResult LoadDispatchDeliverPlansCountByCarNo(string strCarNo)
        {
            string strErrText;
            PlanSystem plan = new PlanSystem();
            List<DeliverPlan> listPlan = plan.LoadDispatchDeliverPlans(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, strCarNo, LoginAccountId, LoginStaffName, out strErrText);
            if (listPlan == null)
            {
                throw new Exception(strErrText);
            }

            return Json(listPlan.Count, JsonRequestBehavior.AllowGet);
        }
Exemple #11
0
        public JsonResult LoadForeignDeliverPlansGrid(string sidx, string sord, int page, int rows)
        {
            string strErrText;

            //读取数据
            PlanSystem plan = new PlanSystem();
            List<DeliverPlan> listPlan = plan.LoadForeignDeliverPlans(LoginAccountId, LoginStaffName, out strErrText);
            if (listPlan == null)
            {
                throw new Exception(strErrText);
            }

            //提取当前页面数据
            int nTotalRows = listPlan.Count;
            int nPageIndex = page;
            int nPageSize = rows;
            int nTotalPages = nTotalRows / nPageSize;
            if (nTotalRows % nPageSize > 0)
                nTotalPages++;

            string sortExpression = (sidx ?? "CreateTime") + " " + (sord ?? "DESC");
            var data = listPlan.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from p in data
                      select new
                      {
                          id = p.Id,
                          cell = new string[] {
                              p.Id.ToString(),
                              p.PlanNo,
                              p.CustomerName,
                              p.ShipmentNo,
                              p.DeliveryNo,
                              p.ReceiverName,
                              p.StartCity,
                              p.CarNo,
                              p.DriverName,
                              p.DriverMobileTel,
                              p.ArrivalTime,
                              p.PlanType,
                              p.TotalTunnages.ToString("#0.######"),
                              p.TotalPiles.ToString("#0.######"),
                              p.CreateTime.ToString("yyyy-MM-dd")
                          }
                      }).ToArray(),
                userdata = new
                {
                    PlanNo = InnoSoft.LS.Resources.Labels.Total,
                    TotalTunnages = data.Sum(s => s.TotalTunnages),
                    TotalPiles = data.Sum(s => s.TotalPiles)
                }
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Exemple #12
0
        public JsonResult LoadCustomerApprovePaperPlansGrid(string sidx, string sord, int page, int rows)
        {
            //读取数据
            string strErrText;
            PlanSystem plan = new PlanSystem();
            List<DeliverPlan> listPlan = plan.LoadCustomerApproveDeliverPlans(LoginAccountId, LoginStaffName, out strErrText);
            if (listPlan == null)
            {
                throw new Exception(strErrText);
            }

            //提取当前页面数据
            int nTotalRows = listPlan.Count;
            int nPageIndex = page;
            int nPageSize = rows;
            int nTotalPages = nTotalRows / nPageSize;
            if (nTotalRows % nPageSize > 0)
                nTotalPages++;

            string sortExpression = (sidx ?? "PlanNo") + " " + (sord ?? "ASC");
            var data = listPlan.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from p in data
                      select new
                      {
                          id = p.Id,
                          cell = new string[] {
                              p.Id.ToString(),
                              p.PlanNo,
                              p.CustomerName,
                              p.ShipmentNo,
                              p.DeliveryNo,
                              p.ReceiverName,
                              p.ReceiverCountry + p.ReceiverProvince + p.ReceiverCity + p.ReceiverAddress,
                              p.PlanType
                          }
                      }).ToArray()
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Exemple #13
0
        public JsonResult LoadNoodlePlanGoodsGrid(string id, string sidx, string sord, int page, int rows)
        {
            //读取数据
            string strErrText;
            PlanSystem plan = new PlanSystem();
            List<DeliverPlanGoods> listGoods = plan.LoadDeliverPlanAllGoods(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
            if (listGoods == null)
            {
                throw new Exception(strErrText);
            }

            //提取当前页面数据
            int nTotalRows = listGoods.Count;
            int nPageIndex = page;
            int nPageSize = rows;
            int nTotalPages = nTotalRows / nPageSize;
            if (nTotalRows % nPageSize > 0)
                nTotalPages++;

            string sortExpression = (sidx ?? "GoodsNo") + " " + (sord ?? "ASC");
            var data = listGoods.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from g in data
                      select new
                      {
                          id = g.Id,
                          cell = new string[] {
                              g.GoodsId.ToString(),
                              g.GoodsNo,
                              g.GoodsName,
                              g.SpecModel,
                              g.Packages.ToString("#0"),
                              g.PieceWeight.ToString("#0.######"),
                              g.Tunnages.ToString("#0.######")
                          }
                      }).ToArray(),
                userdata = new
                {
                    GoodsNo = InnoSoft.LS.Resources.Labels.Total,
                    Packages = data.Sum(s => s.Packages),
                    Tunnages = data.Sum(s => s.Tunnages)
                }
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Exemple #14
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);
        }
Exemple #15
0
        public ActionResult CustomerAgreeDeliverPlan(string id)
        {
            string strErrText;
            PlanSystem plan = new PlanSystem();
            bool bSuccess = plan.CustomerAgreeDeliverPlan(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);

            var ret = new
            {
                Success = bSuccess,
                Message = strErrText
            };
            return Json(ret);
        }
Exemple #16
0
        public ActionResult ReprintShipmentBill(string id)
        {
            string strErrText;
            string[] shipmentBillIds = id.Split(',');

            //读取公司名称
            OrganizationSystem organ = new OrganizationSystem();
            List<Organization> listOrgan = organ.LoadOrganizations(LoginAccountId, LoginStaffName, out strErrText);
            if (listOrgan == null)
            {
                throw new Exception(strErrText);
            }
            Organization root = listOrgan.Find(delegate(Organization o) { return o.ParentId == 0; });
            ViewData["CompanyName"] = root.Name;

            //生成Model
            PrintShipmentBillViewModel model = new PrintShipmentBillViewModel();
            model.bills = new List<ShipmentBillViewModel>();

            DeliverSystem deliver = new DeliverSystem();
            PlanSystem plan = new PlanSystem();
            foreach (string shipmentBillId in shipmentBillIds)
            {
                ShipmentBill bill = deliver.LoadShipmentBill(long.Parse(shipmentBillId), LoginAccountId, LoginStaffName, out strErrText);
                if (bill == null)
                {
                    throw new Exception(strErrText);
                }

                List<ShipmentBillGoods> listGoods = deliver.LoadShipmentBillAllGoods(long.Parse(shipmentBillId), LoginAccountId, LoginStaffName, out strErrText);
                if (listGoods == null)
                {
                    throw new Exception(strErrText);
                }

                DeliverPlan deliverPlan = plan.LoadDeliverPlan(bill.PlanId, LoginAccountId, LoginStaffName, out strErrText);
                if (deliverPlan == null)
                {
                    throw new Exception(strErrText);
                }

                ShipmentBillViewModel modelBill = new ShipmentBillViewModel();
                modelBill.BillNo = bill.BillNo;
                modelBill.PlanType = bill.PlanType;
                modelBill.PlanNo = bill.PlanNo;
                modelBill.CustomerName = bill.CustomerName;
                modelBill.PayerName = bill.PayerName;
                modelBill.DeliveryNo = bill.DeliveryNo;
                modelBill.OutType = bill.OutType;
                modelBill.ReceiverName = bill.ReceiverName;
                modelBill.ReceiverCountry = bill.ReceiverCountry;
                modelBill.ReceiverProvince = bill.ReceiverProvince;
                modelBill.ReceiverCity = bill.ReceiverCity;
                modelBill.ReceiverAddress = bill.ReceiverAddress;
                modelBill.ReceiverContact = bill.ReceiverContact;
                modelBill.ReceiverContactTel = bill.ReceiverContactTel;
                modelBill.OrderNo = bill.OrderNo;
                modelBill.ReceiveType = bill.ReceiveType;
                modelBill.CarNo = bill.CarNo;
                modelBill.TrailerNo = bill.TrailerNo;
                modelBill.Warehouse = bill.Warehouse;
                modelBill.TotalPackages = bill.TotalPackages;
                modelBill.TotalTunnages = bill.TotalTunnages;
                modelBill.TotalPiles = bill.TotalPiles;
                modelBill.TotalTenThousands = bill.TotalTenThousands;
                modelBill.Remark = bill.Remark;
                modelBill.CreateTime = bill.CreateTime.ToString("yyyy-MM-dd");
                modelBill.CreatorName = deliverPlan.CreatorName;

                modelBill.Goods = new List<ShipmentBillGoodsViewModel>();
                foreach (ShipmentBillGoods goods in listGoods)
                {
                    ShipmentBillGoodsViewModel modelGoods = new ShipmentBillGoodsViewModel();
                    modelGoods.GoodsName = goods.GoodsName;
                    modelGoods.GoodsNo = goods.GoodsNo;
                    modelGoods.SpecModel = goods.SpecModel;
                    modelGoods.GWeight = goods.GWeight;
                    modelGoods.Grade = goods.Grade;
                    modelGoods.PieceWeight = goods.PieceWeight;
                    modelGoods.Packing = goods.Packing;
                    modelGoods.BatchNo = goods.BatchNo;
                    modelGoods.Location = goods.Location;
                    modelGoods.Packages = goods.Packages;
                    modelGoods.Tunnages = goods.Tunnages;
                    modelGoods.Piles = goods.Piles;
                    modelGoods.TenThousands = goods.TenThousands;

                    modelBill.Goods.Add(modelGoods);
                }

                model.bills.Add(modelBill);
            }

            return View(model);
        }
Exemple #17
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);
        }
Exemple #18
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);
        }
Exemple #19
0
        public ActionResult DispatchNoodlePlan(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);
            }

            //读取发货计划起讫点的距离
            int nKM = 0;
            DDSystem dd = new DDSystem();
            ReceiverDistance distance = dd.LoadReceiverDistance(deliverPlan.ReceiverName, deliverPlan.StartCountry, deliverPlan.StartProvince, deliverPlan.StartCity, LoginAccountId, LoginStaffName, out strErrText);
            if (distance != null)
            {
                nKM = distance.KM;
            }

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

            model.DeliverPlans = new List<DispatchBillDeliverPlanViewModel>();
            DispatchBillDeliverPlanViewModel modelDeliverPlan = new DispatchBillDeliverPlanViewModel();
            modelDeliverPlan.PlanId = long.Parse(id);
            modelDeliverPlan.KM = nKM;
            model.DeliverPlans.Add(modelDeliverPlan);

            return View(model);
        }
Exemple #20
0
        public JsonResult LoadGoodsStockGrid(string sidx, string sord, int page, int rows, string customerId, string goodsId, string batchNo, string packing, string warehouse, string location, string productionDate, string enterWarehouseBillId, string consignedDeliveryNo)
        {
            //读取库存数据
            string strErrText;
            StockSystem stock = new StockSystem();
            List<Stock> listStock = stock.LoadGoodsStocksByConditions(customerId, goodsId, batchNo, packing, warehouse, location, productionDate, enterWarehouseBillId, consignedDeliveryNo, LoginAccountId, LoginStaffName, out strErrText);
            if (listStock == null)
            {
                throw new Exception(strErrText);
            }

            //读取已提交未发货数据
            PlanSystem plan = new PlanSystem();
            List<DeliverPlanGoods> listDeliverPlanGoods = plan.LoadDeliverPlanGoodsBalancesByConditions(customerId, goodsId, batchNo, packing, warehouse, location, productionDate, enterWarehouseBillId, consignedDeliveryNo, LoginAccountId, LoginStaffName, out strErrText);
            if (listDeliverPlanGoods == null)
            {
                throw new Exception(strErrText);
            }

            //计算结存数
            foreach (Stock s in listStock)
            {
                foreach (DeliverPlanGoods dpg in listDeliverPlanGoods)
                {
                    if (dpg.GoodsId == s.GoodsId &&
                        dpg.BatchNo == s.BatchNo &&
                        dpg.Packing == s.Packing &&
                        dpg.Warehouse == s.Warehouse &&
                        dpg.Location == s.Location &&
                        dpg.ProductionDate == s.ProductionDate &&
                        dpg.EnterWarehouseBillId == s.EnterWarehouseBillId &&
                        (dpg.Packages > 0 || dpg.Tunnages > 0 || dpg.Piles > 0 || dpg.TenThousands > 0))
                    {
                        if (s.Packages < dpg.Packages)
                        {
                            s.Packages = 0;
                            dpg.Packages -= s.Packages;
                        }
                        else
                        {
                            s.Packages -= dpg.Packages;
                            dpg.Packages = 0;
                        }

                        if (s.Tunnages < dpg.Tunnages)
                        {
                            s.Tunnages = 0;
                            dpg.Tunnages -= s.Tunnages;
                        }
                        else
                        {
                            s.Tunnages -= dpg.Tunnages;
                            dpg.Tunnages = 0;
                        }

                        if (s.Piles < dpg.Piles)
                        {
                            s.Piles = 0;
                            dpg.Piles -= s.Piles;
                        }
                        else
                        {
                            s.Piles -= dpg.Piles;
                            dpg.Piles = 0;
                        }

                        if (s.TenThousands < dpg.TenThousands)
                        {
                            s.TenThousands = 0;
                            dpg.TenThousands -= s.TenThousands;
                        }
                        else
                        {
                            s.TenThousands -= dpg.TenThousands;
                            dpg.TenThousands = 0;
                        }
                    }
                }
            }

            //检查已提交未发货剩余数字
            if (listDeliverPlanGoods.Sum(g => g.Packages) > 0 || listDeliverPlanGoods.Sum(g => g.Tunnages) > 0 || listDeliverPlanGoods.Sum(g => g.Piles) > 0 || listDeliverPlanGoods.Sum(g => g.TenThousands) > 0)
            {
                throw new Exception(InnoSoft.LS.Resources.Strings.SubmitedDeliverPlanGoodsNotCompleteSubtract);
            }

            //剔除结存件数为0的记录
            listStock = listStock.Where(s => s.Packages > 0 || s.Tunnages > 0 || s.Piles > 0 || s.TenThousands > 0).ToList();

            //记录编号
            for (int i = 0; i < listStock.Count; i++)
            {
                listStock[i].Id = i + 1;
            }

            //提取当前页面数据
            int nTotalRows = listStock.Count;
            int nPageIndex = page;
            int nPageSize = rows;
            int nTotalPages = nTotalRows / nPageSize;
            if (nTotalRows % nPageSize > 0)
                nTotalPages++;

            var data = listStock.OrderBy(s => s.BatchNo).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from s in data
                      select new
                      {
                          id = s.Id,
                          cell = new string[] {
                              s.GoodsId.ToString(),
                              s.GoodsNo,
                              s.GoodsName,
                              s.Brand,
                              s.SpecModel,
                              s.GWeight,
                              s.Grade,
                              s.BatchNo,
                              s.Packing,
                              s.Location,
                              s.Packages.ToString(),
                              s.Packages != 0 ? (s.Tunnages / s.Packages).ToString("#0.######") : s.PieceWeight.ToString("#0.######"),
                              s.Tunnages.ToString("#0.######"),
                              s.Piles.ToString("#0.######"),
                              s.TenThousands.ToString("#0.######"),
                              s.ProductionDate,
                              s.EnterWarehouseBillId.ToString(),
                              s.EnterWarehouseBillNo,
                              "0",
                              "0",
                              "0",
                              "0"
                          }
                      }).ToArray(),
                userdata = new
                {
                    GoodsNo = InnoSoft.LS.Resources.Labels.Total,
                    Packages = data.Sum(s => s.Packages),
                    Tunnages = data.Sum(s => s.Tunnages),
                    Piles = data.Sum(s => s.Piles),
                    TenThousands = data.Sum(s => s.TenThousands),
                    ActualPackages = 0,
                    ActualTunnages = 0,
                    ActualPiles = 0,
                    ActualTenThousands = 0
                }
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Exemple #21
0
        public JsonResult LoadSearchDeliverPlansGrid(string sidx, string sord, int page, int rows, string startTime, string endTime, string customerName, string shipmentNo, string deliveryNo, string deliverType, string receiverName, string startCountry, string startProvince, string startCity, string destCountry, string destProvince, string destCity, string carNo, string goodsNo, string planNo)
        {
            //读取数据
            string strErrText;
            PlanSystem plan = new PlanSystem();
            List<DeliverPlan> listPlan = plan.LoadDeliverPlansByConditions(startTime, endTime, customerName, shipmentNo, deliveryNo, deliverType, receiverName, startCountry, startProvince, startCity, destCountry, destProvince, destCity, carNo, goodsNo, planNo, LoginAccountId, LoginStaffName, out strErrText);
            if (listPlan == null)
            {
                throw new Exception(strErrText);
            }

            //提取当前页面数据
            int nTotalRows = listPlan.Count;
            int nPageIndex = page;
            int nPageSize = rows;
            int nTotalPages = nTotalRows / nPageSize;
            if (nTotalRows % nPageSize > 0)
                nTotalPages++;

            string sortExpression = (sidx ?? "CreateTime") + " " + (sord ?? "DESC");
            var data = listPlan.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from p in data
                      select new
                      {
                          id = p.Id,
                          cell = new string[] {
                              p.Id.ToString(),
                              p.PlanNo,
                              p.CustomerName,
                              p.ShipmentNo,
                              p.DeliveryNo,
                              p.ReceiverName,
                              p.ReceiverCountry + p.ReceiverProvince + p.ReceiverCity + p.ReceiverAddress,
                              p.StartCity,
                              p.ReceiverCity,
                              p.PlanType,
                              p.CreateTime.ToString("yyyy-MM-dd"),
                              p.PlanState,
                              p.IsDelete.ToString(),
                              p.IsContractReversed.ToString(),
                              p.IsCustomerTransportChargesSettled.ToString(),
                              p.IsCarrierTransportChargesSettled.ToString()
                          }
                      }).ToArray()
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Exemple #22
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);
            }
        }
Exemple #23
0
        public ActionResult LoadNoodlePlanDetails(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
            NoodlePlanViewModel model = new NoodlePlanViewModel();
            model.Id = data.Id;
            model.CustomerId = data.CustomerId;
            model.CustomerName = data.CustomerName;
            model.DeliveryNo = data.DeliveryNo;
            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.Warehouse = data.Warehouse;
            model.ArrivalTime = data.ArrivalTime;
            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("NoodlePlanDetails", model);
        }
Exemple #24
0
 public ActionResult ModifyDeliverPlanRemark(DeliverPlanRemarkViewModel model)
 {
     if (ModelState.IsValid)
     {
         //保存数据
         string strErrText;
         PlanSystem plan = new PlanSystem();
         if (plan.UpdateDeliverPlanRemark(model.Id, model.Remark, LoginAccountId, LoginStaffName, out strErrText))
         {
             return Json(string.Empty);
         }
         else
         {
             return Json(strErrText);
         }
     }
     return View(model);
 }
Exemple #25
0
 public JsonResult HasDispatchDeliverPlans(string customerId, string warehouse)
 {
     //读取数据
     string strErrText;
     PlanSystem plan = new PlanSystem();
     List<DeliverPlan> listPlan = plan.LoadDispatchDeliverPlansByCustomerIdAndWarehouse(long.Parse(customerId), warehouse, LoginAccountId, LoginStaffName, out strErrText);
     if (listPlan == null)
     {
         throw new Exception(strErrText);
     }
     if (listPlan.Count > 0)
         return Json(true, JsonRequestBehavior.AllowGet);
     else
         return Json(false, JsonRequestBehavior.AllowGet);
 }
Exemple #26
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 #27
0
        public JsonResult LoadDeliverPlan(long nPlanId)
        {
            string strErrText;
            PlanSystem plan = new PlanSystem();
            DeliverPlan data = plan.LoadDeliverPlan(nPlanId, LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                return Json(null, JsonRequestBehavior.AllowGet);
            }
            else
            {
                var ret = new
                {
                    ShipmentNo = data.ShipmentNo,
                    DeliveryNo = data.DeliveryNo,
                    CustomerId = data.CustomerId,
                    CustomerName = data.CustomerName,
                    PayerId = data.PayerId,
                    PayerName = data.PayerName,
                    ReceiverName = data.ReceiverName,
                    StartCountry = data.StartCountry,
                    StartProvince = data.StartProvince,
                    StartCity = data.StartCity,
                    DestCountry = data.ReceiverCountry,
                    DestProvince = data.ReceiverProvince,
                    DestCity = data.ReceiverCity,
                    PlanType = data.PlanType,
                    ReceiveType = data.ReceiveType,
                    CarNo = data.CarNo,
                    TrailerNo = data.TrailerNo,
                    DriverName = data.DriverName,
                    DriverLicenseNo = data.DriverLicenseNo,
                    DriverMobileTel = data.DriverMobileTel,
                    DriverHomeTel = data.DriverHomeTel,
                    CarrierId = data.CarrierId,
                    CarrierName = data.CarrierName,
                    CreateTime = data.CreateTime.ToString("yyyy-MM-dd"),
                    Remark = data.Remark
                };

                return Json(ret, JsonRequestBehavior.AllowGet);
            }
        }
Exemple #28
0
        public JsonResult LoadDispatchDeliverPlansGrid(string sidx, string sord, int page, int rows, string organId, string customerName, string shipmentNo, string deliveryNo, string receiverName, string destCountry, string destProvince, string destCity, string warehouse, string arrivalTime, string carNo)
        {
            //读取数据
            string strErrText;
            PlanSystem plan = new PlanSystem();
            List<DeliverPlan> listPlan = plan.LoadDispatchDeliverPlans(organId, customerName, shipmentNo, deliveryNo, receiverName, destCountry, destProvince, destCity, warehouse, arrivalTime, carNo, LoginAccountId, LoginStaffName, out strErrText);
            if (listPlan == null)
            {
                throw new Exception(strErrText);
            }

            //提取当前页面数据
            int nTotalRows = listPlan.Count;
            int nPageIndex = page;
            int nPageSize = rows;
            int nTotalPages = nTotalRows / nPageSize;
            if (nTotalRows % nPageSize > 0)
                nTotalPages++;

            string sortExpression = (sidx ?? "CreateTime") + " " + (sord ?? "ASC");
            var data = listPlan.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList();

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from p in data
                      select new
                      {
                          id = p.Id,
                          cell = new string[] {
                              p.Id.ToString(),
                              p.PlanNo,
                              p.CustomerName,
                              p.ShipmentNo,
                              p.DeliveryNo,
                              p.ReceiverName,
                              p.ReceiverCity,
                              p.Warehouse,
                              p.ArrivalTime,
                              p.PlanType,
                              p.BalanceTunnages.ToString("#0.######"),
                              p.BalancePiles.ToString("#0.######"),
                              p.CreateTime.ToString("yyyy-MM-dd"),
                              p.ReceiveType,
                              p.CarNo,
                              p.Remark
                          }
                      }).ToArray(),
                userdata = new
                {
                    PlanNo = InnoSoft.LS.Resources.Labels.Total,
                    BalanceTunnages = data.Sum(s => s.BalanceTunnages),
                    BalancePiles = data.Sum(s => s.BalancePiles)
                }
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }