Example #1
0
        public ActionResult NewStaff()
        {
            string strErrText;

            //生成组织部门下拉列表项
            OrganizationSystem organ = new OrganizationSystem();
            List<Organization> listOrganization = organ.LoadOrganizations(LoginAccountId, LoginStaffName, out strErrText);
            if (listOrganization == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListOrganization = new List<SelectListItem>();
            selectListOrganization.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListOrganization.AddRange(from o in listOrganization
                                            orderby o.FullName
                                            select new SelectListItem
                                            {
                                                Text = o.FullName,
                                                Value = o.Id.ToString()
                                            });
            ViewData["Organizations"] = new SelectList(selectListOrganization, "Value", "Text");

            //生成岗位下拉列表项
            PositionSystem position = new PositionSystem();
            List<Position> listPosition = position.LoadPositions(LoginAccountId, LoginStaffName, out strErrText);
            if (listPosition == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListPosition = new List<SelectListItem>();
            selectListPosition.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListPosition.AddRange(from p in listPosition
                                        select new SelectListItem
                                        {
                                            Text = p.Name,
                                            Value = p.Id.ToString()
                                        });

            ViewData["Positions"] = new SelectList(selectListPosition, "Value", "Text");

            //生成上司下拉列表项
            StaffSystem staff = new StaffSystem();
            List<Staff> listStaff = staff.LoadStaffs(LoginAccountId, LoginStaffName, out strErrText);
            if (listStaff == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListStaff = new List<SelectListItem>();
            selectListStaff.Add(new SelectListItem { Text = string.Empty, Value = "0" });
            selectListStaff.AddRange(from s in listStaff
                                     select new SelectListItem
                                     {
                                         Text = s.FullName,
                                         Value = s.Id.ToString()
                                     });
            ViewData["Bosses"] = new SelectList(selectListStaff, "Value", "Text");

            //创建空的Model
            StaffViewModel model = new StaffViewModel();

            return View(model);
        }
Example #2
0
        public ActionResult LoadPrintStocktaking(string warehouse, string location)
        {
            string strErrText;

            //读取公司名称
            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; });

            //读取库存数据
            StockSystem stock = new StockSystem();
            List<Stock> listStock = stock.LoadStocktakingByConditions(warehouse, location, LoginAccountId, LoginStaffName, out strErrText);
            if (listStock == null)
            {
                throw new Exception(strErrText);
            }

            //生成HTML
            int nTotalPackages = 0;
            decimal decTotalTunnages = 0;
            decimal decTotalPiles = 0;
            decimal decTotalTenThousands = 0;

            StringBuilder sb = new StringBuilder();

            //标题
            sb.Append("<table border='0' cellpadding='0' cellspacing='0' style='margin-left: auto; margin-right: auto; text-align: left;'>");
            sb.Append("<tr>");
            sb.Append("<td align='center' style='font-size: 20pt; font-weight: bold;'>");
            sb.Append(root.Name);
            sb.Append("</td>");
            sb.Append("</tr>");
            sb.Append("<tr>");
            sb.Append("<td align='center' style='font-size: 16pt;'>");
            sb.Append(InnoSoft.LS.Resources.Titles.Stocktaking);
            sb.Append("</td>");
            sb.Append("</tr>");
            sb.Append("<tr>");
            sb.Append("<td>");

            //表头
            sb.Append("<table id='stocktaking' border='0' cellpadding='0' cellspacing='0'>");
            sb.Append("<tr>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; width: 60px;'>");
            sb.Append(InnoSoft.LS.Resources.Labels.Warehouse);
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; width: 40px;'>");
            sb.Append(InnoSoft.LS.Resources.Labels.Location);
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; width: 120px;'>");
            sb.Append(InnoSoft.LS.Resources.Labels.GoodsNo);
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; width: 150px;'>");
            sb.Append(InnoSoft.LS.Resources.Labels.GoodsName);
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; width: 80px;'>");
            sb.Append(InnoSoft.LS.Resources.Labels.Specification);
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; width: 50px;'>");
            sb.Append(InnoSoft.LS.Resources.Labels.GrammeWeight);
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; width: 50px;'>");
            sb.Append(InnoSoft.LS.Resources.Labels.Grade);
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; width: 200px;'>");
            sb.Append(InnoSoft.LS.Resources.Labels.CustomerName);
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; width: 60px;'>");
            sb.Append(InnoSoft.LS.Resources.Labels.Pieces);
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; width: 80px;'>");
            sb.Append(InnoSoft.LS.Resources.Labels.Tunnages);
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; width: 80px;'>");
            sb.Append(InnoSoft.LS.Resources.Labels.Piles);
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; width: 80px;'>");
            sb.Append(InnoSoft.LS.Resources.Labels.TenThousands);
            sb.Append("</td>");
            sb.Append("</tr>");

            //生成仓库数据
            //var grpWarehouses = from s in listStock
            //                    group s by s.Warehouse;
            var grpWarehouses = listStock.GroupBy(s => s.Warehouse).OrderBy(s => s.Key);
            foreach (var grpWarehouse in grpWarehouses)
            {
                string strWarehouse = grpWarehouse.Key;
                int nWarehouseTotalPackages = grpWarehouse.Sum(s => s.Packages);
                decimal decWarehouseTotalTunnages = grpWarehouse.Sum(s => s.Tunnages);
                decimal decWarehouseTotalPiles = grpWarehouse.Sum(s => s.Piles);
                decimal decWarehouseTotalTenThousands = grpWarehouse.Sum(s => s.TenThousands);

                nTotalPackages += nWarehouseTotalPackages;
                decTotalTunnages += decWarehouseTotalTunnages;
                decTotalPiles += decWarehouseTotalPiles;
                decTotalTenThousands += decWarehouseTotalTenThousands;

                sb.Append("<tr>");
                sb.Append("<td rowspan='").Append((from s in listStock where s.Warehouse == strWarehouse group s by s.Location).Count() + (from s in listStock where s.Warehouse == strWarehouse select s.CustomerId).Count() + 1).Append("' align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                sb.Append(strWarehouse);
                sb.Append("</td>");
                sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                sb.Append("&nbsp;");
                sb.Append("</td>");
                sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                sb.Append("&nbsp;");
                sb.Append("</td>");
                sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                sb.Append("&nbsp;");
                sb.Append("</td>");
                sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                sb.Append("&nbsp;");
                sb.Append("</td>");
                sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                sb.Append("&nbsp;");
                sb.Append("</td>");
                sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                sb.Append("&nbsp;");
                sb.Append("</td>");
                sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                sb.Append("&nbsp;");
                sb.Append("</td>");
                sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                sb.Append(nWarehouseTotalPackages.ToString());
                sb.Append("</td>");
                sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                sb.Append(decWarehouseTotalTunnages.ToString("#0.######"));
                sb.Append("</td>");
                sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                sb.Append(decWarehouseTotalPiles.ToString("#0.######"));
                sb.Append("</td>");
                sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black;'>");
                sb.Append(decWarehouseTotalTenThousands.ToString("#0.######"));
                sb.Append("</td>");

                sb.Append("</tr>");

                //生成货位数据
                //var grpLocations = from s in listStock
                //                   where s.Warehouse == strWarehouse
                //                   group s by s.Location;

                var grpLocations = grpWarehouse.GroupBy(s => s.Location).OrderBy(s => s.Key);
                foreach (var grpLocation in grpLocations)
                {
                    string strLocation = grpLocation.Key;
                    int nLocationTotalPackages = grpLocation.Sum(s => s.Packages);
                    decimal decLocationTotalTunnages = grpLocation.Sum(s => s.Tunnages);
                    decimal decLocationTotalPiles = grpLocation.Sum(s => s.Piles);
                    decimal decLocationTotalTenThousands = grpLocation.Sum(s => s.TenThousands);

                    sb.Append("<tr>");
                    sb.Append("<td rowspan='").Append((from s in listStock where s.Warehouse == strWarehouse && s.Location == strLocation select s.CustomerId).Count() + 1).Append("' align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                    sb.Append(strLocation);
                    sb.Append("</td>");
                    sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                    sb.Append("&nbsp;");
                    sb.Append("</td>");
                    sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                    sb.Append("&nbsp;");
                    sb.Append("</td>");
                    sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                    sb.Append("&nbsp;");
                    sb.Append("</td>");
                    sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                    sb.Append("&nbsp;");
                    sb.Append("</td>");
                    sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                    sb.Append("&nbsp;");
                    sb.Append("</td>");
                    sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                    sb.Append("&nbsp;");
                    sb.Append("</td>");
                    sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                    sb.Append(nLocationTotalPackages.ToString());
                    sb.Append("</td>");
                    sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                    sb.Append(decLocationTotalTunnages.ToString("#0.######"));
                    sb.Append("</td>");
                    sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                    sb.Append(decLocationTotalPiles.ToString("#0.######"));
                    sb.Append("</td>");
                    sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black;'>");
                    sb.Append(decLocationTotalTenThousands.ToString("#0.######"));
                    sb.Append("</td>");
                    sb.Append("</tr>");

                    //生成货位明细数据
                    //var goods = from s in listStock
                    //            where s.Warehouse == strWarehouse && s.Location == strLocation
                    //            select new
                    //            {
                    //                s.GoodsNo,
                    //                s.GoodsName,
                    //                s.SpecModel,
                    //                s.GWeight,
                    //                s.Grade,
                    //                s.CustomerName,
                    //                s.Packages,
                    //                s.Tunnages
                    //            };

                    var goods = from s in grpLocation
                                select new
                                {
                                    s.GoodsNo,
                                    s.GoodsName,
                                    s.SpecModel,
                                    s.GWeight,
                                    s.Grade,
                                    s.CustomerName,
                                    s.Packages,
                                    s.Tunnages,
                                    s.Piles,
                                    s.TenThousands
                                };

                    foreach (var g in goods)
                    {
                        sb.Append("<tr>");
                        sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                        sb.Append(g.GoodsNo);
                        sb.Append("</td>");
                        sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                        sb.Append(g.GoodsName);
                        sb.Append("</td>");
                        sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                        sb.Append(g.SpecModel);
                        sb.Append("</td>");
                        sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                        sb.Append(g.GWeight);
                        sb.Append("</td>");
                        sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                        sb.Append(g.Grade);
                        sb.Append("</td>");
                        sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                        sb.Append(g.CustomerName);
                        sb.Append("</td>");
                        sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                        sb.Append(g.Packages.ToString());
                        sb.Append("</td>");
                        sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                        sb.Append(g.Tunnages.ToString("#0.######"));
                        sb.Append("</td>");
                        sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black;'>");
                        sb.Append(g.Piles.ToString("#0.######"));
                        sb.Append("</td>");
                        sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black;'>");
                        sb.Append(g.TenThousands.ToString("#0.######"));
                        sb.Append("</td>");
                        sb.Append("</tr>");
                    }
                }
            }

            //合计
            sb.Append("<tr>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black;'>");
            sb.Append(InnoSoft.LS.Resources.Labels.FinalTotal);
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black;'>");
            sb.Append("&nbsp;");
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black;'>");
            sb.Append("&nbsp;");
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black;'>");
            sb.Append("&nbsp;");
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black;'>");
            sb.Append("&nbsp;");
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black;'>");
            sb.Append("&nbsp;");
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black;'>");
            sb.Append("&nbsp;");
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black;'>");
            sb.Append("&nbsp;");
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black;'>");
            sb.Append(nTotalPackages.ToString());
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black;'>");
            sb.Append(decTotalTunnages.ToString("#0.######"));
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black;'>");
            sb.Append(decTotalPiles.ToString("#0.######"));
            sb.Append("</td>");
            sb.Append("<td align='center' valign='top' style='border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; border-bottom: 1px solid black;'>");
            sb.Append(decTotalTenThousands.ToString("#0.######"));
            sb.Append("</td>");
            sb.Append("</tr>");

            sb.Append("</table>");
            sb.Append("</td>");
            sb.Append("</tr>");
            sb.Append("</table>");

            return Content(sb.ToString());
        }
Example #3
0
        public ActionResult NewCustomer()
        {
            string strErrText;

            //生成所属组织部门下拉列表项
            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; });
            List<SelectListItem> selectListOrgan = new List<SelectListItem>();
            selectListOrgan.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListOrgan.AddRange(from o in listOrgan
                                     where o.ParentId == root.Id
                                     select new SelectListItem
                                     {
                                         Text = o.Name,
                                         Value = o.Id.ToString()
                                     });
            ViewData["OwnOrgans"] = new SelectList(selectListOrgan, "Value", "Text");

            //生成国家下拉列表项
            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");

            //创建空的Model
            CustomerViewModel model = new CustomerViewModel();
            model.GrossWeightRate = "1";

            model.TransportPrices = new List<CustomerTransportPriceViewModel>();
            model.TransportPrices.Add(new CustomerTransportPriceViewModel());

            model.ForceFeePrices = new List<CustomerForceFeePriceViewModel>();
            model.ForceFeePrices.Add(new CustomerForceFeePriceViewModel());

            model.StorageFeePrices = new List<CustomerStorageFeePriceViewModel>();
            model.StorageFeePrices.Add(new CustomerStorageFeePriceViewModel());

            return View(model);
        }
Example #4
0
        public ActionResult NewOrganization(OrganizationViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                Organization data = new Organization();
                data.Name = model.Name;
                data.ParentId = model.ParentId;
                data.CountryName = model.CountryName ?? string.Empty;
                data.ProvinceName = model.StateName ?? string.Empty;
                data.CityName = model.CityName ?? string.Empty;
                data.Address = model.Address ?? string.Empty;
                data.PostalCode = model.PostalCode ?? string.Empty;
                data.Remark = model.Remark ?? string.Empty;

                //保存数据
                string strErrText;
                OrganizationSystem organ = new OrganizationSystem();
                if (organ.InsertOrganization(data, LoginAccountId, LoginStaffName, out strErrText))
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }
Example #5
0
        public ActionResult ReprintDeliverBill(string id)
        {
            string strErrText;
            string[] deliverBillIds = 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
            PrintDeliverBillViewModel model = new PrintDeliverBillViewModel();
            model.bills = new List<DeliverBillViewModel>();

            DeliverSystem deliver = new DeliverSystem();
            foreach (string deliverBillId in deliverBillIds)
            {
                DeliverBill data = deliver.LoadDeliverBill(long.Parse(deliverBillId), LoginAccountId, LoginStaffName, out strErrText);
                if (data == null)
                {
                    throw new Exception(strErrText);
                }

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

                DeliverBillViewModel billVM = new DeliverBillViewModel();
                billVM.Id = data.Id;
                billVM.BillNo = data.BillNo;
                billVM.PlanType = data.PlanType;
                billVM.CustomerName = data.CustomerName;
                billVM.ReceiverName = data.ReceiverName;
                billVM.ReceiverCountry = data.ReceiverCountry;
                billVM.ReceiverProvince = data.ReceiverProvince;
                billVM.ReceiverCity = data.ReceiverCity;
                billVM.ReceiverAddress = data.ReceiverAddress;
                billVM.ReceiverContact = data.ReceiverContact;
                billVM.ReceiverContactTel = data.ReceiverContactTel;
                billVM.ReceiveType = data.ReceiveType;
                billVM.OrderNo = data.OrderNo;
                billVM.CarNo = data.CarNo;
                billVM.TrailerNo = data.TrailerNo;
                billVM.CreateTime = data.CreateTime;
                billVM.TotalPackages = data.TotalPackages;
                billVM.TotalTunnages = data.TotalTunnages;
                billVM.TotalPiles = data.TotalPiles;
                billVM.TotalTenThousands = data.TotalTenThousands;
                billVM.Remark = data.Remark;

                billVM.Goods = new List<DeliverBillGoodsViewModel>();
                foreach (DeliverBillGoods goods in listGoods)
                {
                    DeliverBillGoodsViewModel goodsVM = new DeliverBillGoodsViewModel();
                    goodsVM.GoodsName = goods.GoodsName;
                    goodsVM.GoodsNo = goods.GoodsNo;
                    goodsVM.SpecModel = goods.SpecModel;
                    goodsVM.GWeight = goods.GWeight;
                    goodsVM.Grade = goods.Grade;
                    goodsVM.PieceWeight = goods.PieceWeight;
                    goodsVM.Packing = goods.Packing;
                    goodsVM.BatchNo = goods.BatchNo;
                    goodsVM.Packages = goods.Packages;
                    goodsVM.Tunnages = goods.Tunnages;
                    goodsVM.Piles = goods.Piles;
                    goodsVM.TenThousands = goods.TenThousands;

                    billVM.Goods.Add(goodsVM);
                }
                model.bills.Add(billVM);
            }
            return View(model);
        }
Example #6
0
        public ActionResult NewAccount()
        {
            string strErrText;

            //生成组织部门下拉列表项
            OrganizationSystem organ = new OrganizationSystem();
            List<Organization> listOrganization = organ.LoadOrganizations(LoginAccountId, LoginStaffName, out strErrText);
            if (listOrganization == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListOrganization = new List<SelectListItem>();
            selectListOrganization.Add(new SelectListItem { Text = string.Empty, Value = "0" });
            selectListOrganization.AddRange(from o in listOrganization
                                            orderby o.FullName
                                            select new SelectListItem
                                            {
                                                Text = o.FullName,
                                                Value = o.Id.ToString()
                                            });
            ViewData["Organizations"] = new SelectList(selectListOrganization, "Value", "Text");

            //生成空的员工下拉列表项
            List<Staff> listStaff = new List<Staff>();
            List<SelectListItem> selectListStaff = new List<SelectListItem>();
            selectListStaff.Add(new SelectListItem { Text = string.Empty, Value = "0" });
            selectListStaff.AddRange(from s in listStaff
                                     select new SelectListItem
                                     {
                                         Text = s.Name,
                                         Value = s.Id.ToString()
                                     });
            ViewData["Staffs"] = new SelectList(selectListStaff, "Value", "Text");

            //生成空的客户下拉列表项
            List<Customer> listCustomer = new List<Customer>();
            List<SelectListItem> selectListCustomer = new List<SelectListItem>();
            selectListCustomer.Add(new SelectListItem { Text = string.Empty, Value = "0" });
            selectListCustomer.AddRange(from c in listCustomer
                                        select new SelectListItem
                                        {
                                            Text = c.Name,
                                            Value = c.Id.ToString()
                                        });
            ViewData["Customers"] = new SelectList(selectListCustomer, "Value", "Text");

            //创建空的Model
            AccountViewModel model = new AccountViewModel();

            return View(model);
        }
Example #7
0
        public ActionResult ModifyCustomer(string id)
        {
            string strErrText;

            //生成Model数据
            CustomerSystem customer = new CustomerSystem();
            Customer data = customer.LoadCustomer(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                throw new Exception(strErrText);
            }

            CustomerViewModel model = new CustomerViewModel();
            model.Id = data.Id;
            model.Name = data.Name;
            model.FullName = data.FullName;
            model.WarningStock = data.WarningStock;
            model.StopStock = data.StopStock;
            model.SettlementExpression = data.SettlementExpression;
            model.ValuationMode = data.ValuationMode;
            model.GrossWeightRate = data.GrossWeightRate.ToString("#0.######");
            model.OwnOrganId = data.OwnOrganId;
            model.Remark = data.Remark;

            model.TransportPrices = new List<CustomerTransportPriceViewModel>();
            model.TransportPrices.Add(new CustomerTransportPriceViewModel());

            model.ForceFeePrices = new List<CustomerForceFeePriceViewModel>();
            model.ForceFeePrices.Add(new CustomerForceFeePriceViewModel());

            model.StorageFeePrices = new List<CustomerStorageFeePriceViewModel>();
            model.StorageFeePrices.Add(new CustomerStorageFeePriceViewModel());

            //生成所属组织部门下拉列表项
            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; });
            List<SelectListItem> selectListOrgan = new List<SelectListItem>();
            selectListOrgan.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListOrgan.AddRange(from o in listOrgan
                                     where o.ParentId == root.Id
                                     select new SelectListItem
                                     {
                                         Text = o.Name,
                                         Value = o.Id.ToString()
                                     });
            ViewData["OwnOrgans"] = new SelectList(selectListOrgan, "Value", "Text", model.OwnOrganId.ToString());

            //生成国家下拉列表项
            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);
        }
Example #8
0
        public JsonResult LoadOrganization(long nOrganId)
        {
            string strErrText;
            OrganizationSystem organ = new OrganizationSystem();
            Organization data = organ.LoadOrganization(nOrganId, LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                return Json(null, JsonRequestBehavior.AllowGet);
            }
            else
            {
                var ret = new
                {
                    Id = data.Id,
                    Name = data.Name,
                    CountryName = data.CountryName,
                    ProvinceName = data.ProvinceName,
                    CityName = data.CityName
                };

                return Json(ret, JsonRequestBehavior.AllowGet);
            }
        }
Example #9
0
 public ActionResult DeleteOrganization(string id)
 {
     //删除数据
     string strErrText;
     OrganizationSystem organ = new OrganizationSystem();
     if (organ.DeleteOrganization(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText))
     {
         return Json(string.Empty);
     }
     else
     {
         return Json(strErrText);
     }
 }
Example #10
0
        public ActionResult ModifyAccount(string id)
        {
            string strErrText;

            //生成Model数据
            long nAccountId = long.Parse(id);
            AuthenticateSystem auth = new AuthenticateSystem();
            Account data = auth.LoadAccount(nAccountId, LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                throw new Exception(strErrText);
            }

            AccountViewModel model = new AccountViewModel();
            model.Id = data.Id;
            model.Name = data.Name;
            model.Password = data.Password;
            model.AccountType = data.AccountType;
            model.OrganId = data.AccountType == InnoSoft.LS.Resources.Options.Staff ? data.OrganId : 0;
            model.StaffId = data.AccountType == InnoSoft.LS.Resources.Options.Staff ? data.StaffId : 0;
            model.CustomerId = data.AccountType == InnoSoft.LS.Resources.Options.Staff ? 0 : data.OrganId;
            model.ContactName = data.AccountType == InnoSoft.LS.Resources.Options.Staff ? string.Empty : data.StaffName;
            model.IsCancel = data.IsCancel;

            if (data.AccountType == InnoSoft.LS.Resources.Options.Staff)
            {
                //生成组织部门下拉列表
                OrganizationSystem organ = new OrganizationSystem();
                List<Organization> listOrganization = organ.LoadOrganizations(LoginAccountId, LoginStaffName, out strErrText);
                if (listOrganization == null)
                {
                    throw new Exception(strErrText);
                }
                List<SelectListItem> selectListOrganization = new List<SelectListItem>();
                selectListOrganization.Add(new SelectListItem { Text = string.Empty, Value = "0" });
                selectListOrganization.AddRange(from o in listOrganization
                                                orderby o.FullName
                                                select new SelectListItem
                                                {
                                                    Text = o.FullName,
                                                    Value = o.Id.ToString()
                                                });
                ViewData["Organizations"] = new SelectList(selectListOrganization, "Value", "Text", model.OrganId);

                //生成空的客户下拉列表
                List<Customer> listCustomer = new List<Customer>();
                List<SelectListItem> selectListCustomer = new List<SelectListItem>();
                selectListCustomer.Add(new SelectListItem { Text = string.Empty, Value = "0" });
                selectListCustomer.AddRange(from c in listCustomer
                                            select new SelectListItem
                                            {
                                                Text = c.Name,
                                                Value = c.Id.ToString()
                                            });
                ViewData["Customers"] = new SelectList(selectListCustomer, "Value", "Text");
            }
            else
            {
                //生成空的组织部门下拉列表
                {
                    List<Organization> listOrganization = new List<Organization>();
                    List<SelectListItem> selectListOrganization = new List<SelectListItem>();
                    selectListOrganization.Add(new SelectListItem { Text = string.Empty, Value = "0" });
                    selectListOrganization.AddRange(from o in listOrganization
                                                    select new SelectListItem
                                                    {
                                                        Text = o.FullName,
                                                        Value = o.Id.ToString()
                                                    });
                    ViewData["Organizations"] = new SelectList(selectListOrganization, "Value", "Text");
                }

                //生成客户下拉列表
                CustomerSystem customer = new CustomerSystem();
                List<Customer> listCustomer = customer.LoadCustomers(LoginAccountId, LoginStaffName, out strErrText);
                if (listCustomer == null)
                {
                    throw new Exception(strErrText);
                }
                List<SelectListItem> selectListCustomer = new List<SelectListItem>();
                selectListCustomer.Add(new SelectListItem { Text = string.Empty, Value = "0" });
                selectListCustomer.AddRange(from c in listCustomer
                                            orderby c.Name
                                            select new SelectListItem
                                            {
                                                Text = c.Name,
                                                Value = c.Id.ToString()
                                            });
                ViewData["Customers"] = new SelectList(selectListCustomer, "Value", "Text", model.OrganId);
            }

            //生成员工下拉列表
            if (data.AccountType == InnoSoft.LS.Resources.Options.Staff)
            {
                StaffSystem staff = new StaffSystem();
                List<Staff> listStaff = staff.LoadStaffsByOrganId(model.OrganId, LoginAccountId, LoginStaffName, out strErrText);
                if (listStaff == null)
                {
                    throw new Exception(strErrText);
                }
                List<SelectListItem> selectListStaff = new List<SelectListItem>();
                selectListStaff.Add(new SelectListItem { Text = string.Empty, Value = "0" });
                selectListStaff.AddRange(from s in listStaff
                                         select new SelectListItem
                                         {
                                             Text = s.FullName,
                                             Value = s.Id.ToString()
                                         });

                ViewData["Staffs"] = new SelectList(selectListStaff, "Value", "Text", model.StaffId);
            }
            else
            {
                List<Staff> listStaff = new List<Staff>();
                List<SelectListItem> selectListStaff = new List<SelectListItem>();
                selectListStaff.Add(new SelectListItem { Text = string.Empty, Value = "0" });
                selectListStaff.AddRange(from s in listStaff
                                         select new SelectListItem
                                         {
                                             Text = s.Name,
                                             Value = s.Id.ToString()
                                         });
                ViewData["Staffs"] = new SelectList(selectListStaff, "Value", "Text");
            }

            return View(model);
        }
Example #11
0
        /// <summary>
        /// GET组织结构图JS脚本
        /// </summary>
        /// <returns></returns>
        public ActionResult LoadOrganizationsChart()
        {
            string strErrText;

            //读取所有组织部门数据
            OrganizationSystem sys = new OrganizationSystem();
            List<Organization> listOrganization = sys.LoadOrganizations(LoginAccountId, LoginStaffName, out strErrText);
            if (listOrganization == null)
            {
                throw new Exception(strErrText);
            }

            //生成根组织部门JS脚本
            StringBuilder js = new StringBuilder();
            js.Append("<ul id='org' style='display: none'>");

            List<Organization> listRoot = listOrganization.FindAll(delegate(Organization o) { return o.ParentId == 0; });
            foreach (Organization root in listRoot)
            {
                js.Append("<li>");
                js.Append(root.Name).Append("<input type='hidden' value='" + root.Id + "' />");

                //递归生成子组织部门JS脚本
                RecursiveMakeOrganizationsChart(listOrganization, root.Id, ref js);

                js.Append("</li>");
            }
            js.Append("</ul>");

            return Content(js.ToString());
        }
Example #12
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);
        }
Example #13
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);
        }
Example #14
0
        public ActionResult PrintContract(string id)
        {
            string strErrText;

            //读取公司名称
            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;

            //读取合同数据
            ContractSystem contract = new ContractSystem();
            Contract data = contract.LoadContract(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                throw new Exception(strErrText);
            }

            //创建Model
            ContractViewModel model = new ContractViewModel();
            model.Id = data.Id;
            model.DispatchBillId = data.DispatchBillId;
            model.ContractNo = data.ContractNo;
            model.CarNo = data.CarNo;
            model.TrailerNo = data.TrailerNo;
            model.DriverName = data.DriverName;
            model.DriverLicenseNo = data.DriverLicenseNo;
            model.DriverMobileTel = data.DriverMobileTel;
            model.DriverHomeTel = data.DriverHomeTel;
            model.CarrierId = data.CarrierId;
            model.CarrierName = data.CarrierName;
            model.GoodsName = data.GoodsName;
            model.Packing = data.Packing;
            model.StartPlace = data.StartPlace;
            model.DestPlace = data.DestPlace;
            model.ShipmentTime = data.ShipmentTime.ToString("yyyy-MM-dd");
            model.ArrivalTime = data.ArrivalTime.ToString("yyyy-MM-dd");
            model.TotalPackages = data.TotalPackages;
            model.TotalTunnages = data.TotalTunnages;
            model.TotalPiles = data.TotalPiles;
            model.TotalTenThousands = data.TotalTenThousands;
            model.TotalTransportCharges = data.TotalTransportCharges;
            model.PrepayTransportCharges = data.PrepayTransportCharges;
            model.ResidualTransportCharges = data.ResidualTransportCharges;
            model.OriginalContractNo = data.OriginalContractNo;

            return View(model);
        }
Example #15
0
        public ActionResult ModifyOrganization(string id)
        {
            string strErrText;

            //生成Model数据
            OrganizationSystem organ = new OrganizationSystem();
            Organization data = organ.LoadOrganization(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                throw new Exception(strErrText);
            }

            OrganizationViewModel model = new OrganizationViewModel();
            model.Id = data.Id;
            model.Name = data.Name;
            model.ParentId = data.ParentId;
            model.CountryName = data.CountryName;
            model.StateName = data.ProvinceName;
            model.CityName = data.CityName;
            model.Address = data.Address;
            model.PostalCode = data.PostalCode;
            model.Remark = data.Remark;

            //生成上级组织部门下拉列表项
            List<Organization> listOrganization = organ.LoadOrganizations(LoginAccountId, LoginStaffName, out strErrText);
            if (listOrganization == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListOrganization = new List<SelectListItem>();
            selectListOrganization.Add(new SelectListItem { Text = string.Empty, Value = "0" });
            selectListOrganization.AddRange(from o in listOrganization
                                            where !o.FullPath.StartsWith(data.FullPath)
                                            orderby o.FullName
                                            select new SelectListItem
                                            {
                                                Text = o.FullName,
                                                Value = o.Id.ToString()
                                            });
            ViewData["Organizations"] = new SelectList(selectListOrganization, "Value", "Text", model.ParentId);

            //生成国家下拉列表项
            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["Countries"] = new SelectList(selectListCountry, "Value", "Text", model.CountryName);

            //生成空的省份下拉列表项
            List<Province> listState = null;
            if (!string.IsNullOrEmpty(model.CountryName))
            {
                listState = dd.LoadProvincesByCountry(model.CountryName, LoginAccountId, LoginStaffName, out strErrText);
                if (listState == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                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["States"] = new SelectList(selectListState, "Value", "Text", model.StateName);

            //生成空的城市下拉列表项
            List<City> listCity = null;
            if (!string.IsNullOrEmpty(model.StateName))
            {
                listCity = dd.LoadCitysByProvince(model.CountryName, model.StateName, LoginAccountId, LoginStaffName, out strErrText);
                if (listCity == null)
                {
                    throw new Exception(strErrText);
                }
            }
            else
            {
                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["Cities"] = new SelectList(selectListCity, "Value", "Text", model.CityName);

            return View(model);
        }
Example #16
0
        public ActionResult SearchContracts()
        {
            string strErrText;

            //生成国家下拉列表项
            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");

            //生成组织部门下拉列表项
            OrganizationSystem organ = new OrganizationSystem();
            List<Organization> listOrganization = organ.LoadOrganizations(LoginAccountId, LoginStaffName, out strErrText);
            if (listOrganization == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListOrganization = new List<SelectListItem>();
            selectListOrganization.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListOrganization.AddRange(from o in listOrganization
                                            orderby o.FullName
                                            select new SelectListItem
                                            {
                                                Text = o.FullName,
                                                Value = o.Id.ToString()
                                            });
            ViewData["Organizations"] = new SelectList(selectListOrganization, "Value", "Text");

            return View();
        }
Example #17
0
        public ActionResult ModifyStaff(string id)
        {
            string strErrText;

            //生成Model数据
            long nStaffId = long.Parse(id);
            StaffSystem staff = new StaffSystem();
            Staff data = staff.LoadStaff(nStaffId, LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                throw new Exception(strErrText);
            }

            StaffViewModel model = new StaffViewModel();
            model.Id = data.Id;
            model.FamilyName = data.FamilyName;
            model.Name = data.Name;
            model.Sex = data.Sex;
            model.OrganId = data.OrganId;
            model.PositionId = data.PositionId;
            model.OfficeTel = data.OfficeTel;
            model.TelExt = data.TelExt;
            model.Fax = data.Fax;
            model.MobileTel1 = data.MobileTel1;
            model.MobileTel2 = data.MobileTel2;
            model.MobileTel3 = data.MobileTel3;
            model.EMail = data.EMail;
            model.QQ = data.QQ;
            model.IsOrganManager = data.IsOrganManager;
            model.IsOrganLeader = data.IsOrganLeader;
            model.BossStaffId = data.BossStaffId;

            //生成组织部门下拉列表项
            OrganizationSystem organ = new OrganizationSystem();
            List<Organization> listOrganization = organ.LoadOrganizations(LoginAccountId, LoginStaffName, out strErrText);
            if (listOrganization == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListOrganization = new List<SelectListItem>();
            selectListOrganization.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListOrganization.AddRange(from o in listOrganization
                                            orderby o.FullName
                                            select new SelectListItem
                                            {
                                                Text = o.FullName,
                                                Value = o.Id.ToString()
                                            });
            ViewData["Organizations"] = new SelectList(selectListOrganization, "Value", "Text", model.OrganId);

            //生成岗位下拉列表项
            PositionSystem position = new PositionSystem();
            List<Position> listPosition = position.LoadPositions(LoginAccountId, LoginStaffName, out strErrText);
            if (listPosition == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListPosition = new List<SelectListItem>();
            selectListPosition.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListPosition.AddRange(from p in listPosition
                                        select new SelectListItem
                                        {
                                            Text = p.Name,
                                            Value = p.Id.ToString()
                                        });

            ViewData["Positions"] = new SelectList(selectListPosition, "Value", "Text", model.PositionId);

            //生成上司下拉列表项
            List<Staff> listStaff = staff.LoadStaffsExcludeSelfAndSubordinates(nStaffId, LoginAccountId, LoginStaffName, out strErrText);
            if (listStaff == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListStaff = new List<SelectListItem>();
            selectListStaff.Add(new SelectListItem { Text = string.Empty, Value = "0" });
            selectListStaff.AddRange(from s in listStaff
                                     select new SelectListItem
                                     {
                                         Text = s.FullName,
                                         Value = s.Id.ToString()
                                     });
            ViewData["Bosses"] = new SelectList(selectListStaff, "Value", "Text", model.BossStaffId);

            return View(model);
        }
Example #18
0
        public JsonResult LoadOrganizations()
        {
            string strErrText;
            OrganizationSystem organ = new OrganizationSystem();
            List<Organization> listOrganization = organ.LoadOrganizations(LoginAccountId, LoginStaffName, out strErrText);
            if (listOrganization == null)
            {
                throw new Exception(strErrText);
            }

            var ret = from o in listOrganization
                      select new
                      {
                          o.Id,
                          o.Name,
                          o.FullName,
                          o.ParentId,
                          o.ManagerName
                      };

            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Example #19
0
        public ActionResult StatOrganTotalOutput()
        {
            string strErrText;

            //生成组织部门下拉列表项
            OrganizationSystem organ = new OrganizationSystem();
            List<Organization> listOrganization = organ.LoadOrganizations(LoginAccountId, LoginStaffName, out strErrText);
            if (listOrganization == null)
            {
                throw new Exception(strErrText);
            }
            List<SelectListItem> selectListOrganization = new List<SelectListItem>();
            selectListOrganization.Add(new SelectListItem { Text = string.Empty, Value = string.Empty });
            selectListOrganization.AddRange(from o in listOrganization
                                            orderby o.FullName
                                            select new SelectListItem
                                            {
                                                Text = o.FullName,
                                                Value = o.Id.ToString()
                                            });
            ViewData["Organizations"] = new SelectList(selectListOrganization, "Value", "Text");

            return View();
        }