Exemplo n.º 1
0
 public ActionResult CancelShipmentBill(string id)
 {
     string strErrText;
     DeliverSystem deliver = new DeliverSystem();
     if (deliver.CancelShipmentBill(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText))
     {
         return Json(string.Empty);
     }
     else
     {
         return Json(strErrText);
     }
 }
Exemplo n.º 2
0
        public JsonResult LoadPrintDispatchedShipmentBillsGrid(string sidx, string sord, int page, int rows)
        {
            //读取数据
            string strErrText;
            DeliverSystem deliver = new DeliverSystem();
            List<ShipmentBill> listShipmentBill = deliver.LoadPrintDispatchedShipmentBills(LoginAccountId, LoginStaffName, out strErrText);
            if (listShipmentBill == null)
            {
                throw new Exception(strErrText);
            }

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

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

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from b in data
                      select new
                      {
                          id = b.Id,
                          cell = new string[] {
                              b.Id.ToString(),
                              b.BillNo,
                              b.PlanId.ToString(),
                              b.PlanNo,
                              b.DispatchBillId.ToString(),
                              b.DispatchBillNo,
                              b.CustomerName,
                              b.ShipmentNo,
                              b.DeliveryNo,
                              b.ReceiverName,
                              b.ReceiverCity + b.ReceiverAddress,
                              b.CarNo,
                              b.TrailerNo,
                              b.DriverName,
                              b.DriverMobileTel,
                              b.TotalPackages.ToString(),
                              b.TotalTunnages.ToString("#0.######"),
                              b.TotalPiles.ToString("#0.######"),
                              b.TotalTenThousands.ToString("#0.######")
                          }
                      }).ToArray()
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 3
0
        public JsonResult LoadSyntheticalSearchGrid(string sidx, string sord, int page, int rows, string startTime, string endTime, string payerName, string startCountry, string startProvince, string startCity, string destCountry, string destProvince, string destCity, string carNo, string organId)
        {
            //读取数据
            string strErrText;
            DeliverSystem deliver = new DeliverSystem();
            List<DeliverBill> listBill = deliver.LoadDeliverBillsByConditions(startTime, endTime, string.Empty, string.Empty, payerName, startCountry, startProvince, startCity, destCountry, destProvince, destCity, carNo, string.Empty, organId, string.Empty, LoginAccountId, LoginStaffName, out strErrText);
            if (listBill == null)
            {
                throw new Exception(strErrText);
            }

            //根据结算公式计算运费
            foreach (DeliverBill bill in listBill)
            {
                if (bill.CustomerTransportCharges == 0 && bill.SettlementExpression != null && bill.SettlementExpression != string.Empty)
                {
                    try
                    {
                        EvaluatorHelper evaluator = new EvaluatorHelper();

                        evaluator.SetExpression(bill.SettlementExpression);

                        evaluator.AddVariable(InnoSoft.LS.Resources.Labels.KM, bill.KM == null || bill.KM == string.Empty ? "0" : bill.KM);
                        evaluator.AddVariable(InnoSoft.LS.Resources.Labels.Tunnages, bill.TotalTunnages.ToString());
                        evaluator.AddVariable(InnoSoft.LS.Resources.Labels.Piles, bill.TotalPiles.ToString());
                        evaluator.AddVariable(InnoSoft.LS.Resources.Labels.TransportPrice, bill.CustomerTransportPrice.ToString());
                        evaluator.AddVariable(InnoSoft.LS.Resources.Labels.TransportCharges, "0");

                        string strTransportCharges = evaluator.EvaluateExpression();
                        bill.CustomerTransportCharges = decimal.Parse(strTransportCharges);
                    }
                    catch (Exception e)
                    {
                        throw e;
                    }
                }
            }

            //计算拼车费
            var grpShipmentNos = listBill.GroupBy(s => s.ShipmentNo).OrderBy(s => s.Key);
            foreach (var grpShipmentNo in grpShipmentNos)
            {
                if (grpShipmentNo.Key != null && grpShipmentNo.Key != string.Empty)
                {
                    List<DeliverBill> listShipmentNoDetail = grpShipmentNo.ToList<DeliverBill>();

                    int i = 0;
                    while (i < listShipmentNoDetail.Count)
                    {
                        if (i > 0)
                        {
                            int j = 0;
                            while (j < i)
                            {
                                if (listShipmentNoDetail[i].ReceiverAddress == listShipmentNoDetail[j].ReceiverAddress)
                                {
                                    break;
                                }
                                j++;
                            }
                            if (j >= i)
                            {
                                listShipmentNoDetail[i].CarpoolFee = 100;
                            }
                        }
                        i++;
                    }
                }
            }

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

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

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from b in data
                      select new
                      {
                          id = b.Id,
                          cell = new string[] {
                              b.Id.ToString(),
                              b.ShipmentBillId.ToString(),
                              b.PlanId.ToString(),
                              b.CreateTime.ToString("yyyy-MM-dd"),
                              b.PlanNo,
                              b.CustomerName,
                              b.PayerId.ToString(),
                              b.PayerName,
                              b.ShipmentNo,
                              b.DeliveryNo,
                              b.ReceiverName,
                              b.ReceiverCountry + b.ReceiverProvince + b.ReceiverCity + b.ReceiverAddress,
                              b.StartCity,
                              b.ReceiverCity,
                              b.ReceiveType,
                              b.GoodsName,
                              b.TotalPackages.ToString(),
                              b.TotalTunnages.ToString("#0.######"),
                              b.TotalPiles.ToString("#0.######"),
                              b.TotalTenThousands.ToString("#0.######"),
                              b.CarNo,
                              b.TrailerNo,
                              b.CarType,
                              b.BillNo,
                              b.ContractId.ToString(),
                              b.ContractNo,
                              b.OriginalContractNo,
                              b.TransportCharges.ToString(),
                              (b.CustomerTransportCharges + b.CarpoolFee + b.RiverCrossingCharges).ToString(),
                              (b.CustomerTransportCharges + b.CarpoolFee + b.RiverCrossingCharges - b.TransportCharges).ToString(),
                              b.IsCustomerTransportChargesSettled.ToString(),
                              b.IsCarrierTransportChargesSettled.ToString(),
                              b.IsDeliverBillReceiptReceived.ToString(),
                              b.IsDeliverBillReceiptReceived ? b.ReturnTime.ToString("yyyy-MM-dd") : string.Empty,
                              b.ReverseAmount.ToString(),
                              b.TransportChargesBalance.ToString(),
                              b.Remark
                          }
                      }).ToArray(),
                userdata = new
                {
                    CreateTime = InnoSoft.LS.Resources.Labels.Total,
                    TotalPackages = data.Sum(s => s.TotalPackages),
                    TotalTunnages = data.Sum(s => s.TotalTunnages),
                    TotalPiles = data.Sum(s => s.TotalPiles),
                    TotalTenThousands = data.Sum(s => s.TotalTenThousands),
                    TransportCharges = data.Sum(s => s.TransportCharges),
                    CustomerTransportCharges = data.Sum(s => s.CustomerTransportCharges + s.CarpoolFee + s.RiverCrossingCharges),
                    TransportChargesDifference = data.Sum(s => s.CustomerTransportCharges + s.CarpoolFee + s.RiverCrossingCharges - s.TransportCharges),
                    ReverseAmount = data.Sum(s => s.ReverseAmount),
                    TransportChargesBalance = data.Sum(s => s.TransportChargesBalance)
                }
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 4
0
        public JsonResult LoadPrintDeliverBillsCarNo()
        {
            //读取数据
            string strErrText;
            DeliverSystem deliver = new DeliverSystem();
            List<DeliverBill> listDeliverBill = deliver.LoadPrintDeliverBills(LoginAccountId, LoginStaffName, out strErrText);
            if (listDeliverBill == null)
            {
                throw new Exception(strErrText);
            }

            var ret = (from b in listDeliverBill
                       where b.CarNo != null && b.CarNo != string.Empty
                       select b.CarNo).Distinct();

            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 5
0
        public JsonResult LoadDeliverBillNos(string term)
        {
            //读取所有车辆数据
            string strErrText = string.Empty;
            DeliverSystem deliver = new DeliverSystem();
            List<DeliverBill> listDeliverBills = deliver.LoadDeliverBillNosByNo(term, LoginAccountId, LoginStaffName, out strErrText);
            if (listDeliverBills == null)
            {
                listDeliverBills = new List<DeliverBill>();
            }

            var ret = (from b in listDeliverBills select b.BillNo).ToArray();

            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 6
0
        public JsonResult LoadDeliverBillsOwnOrgansByTimespan(string startTime, string endTime)
        {
            string strErrText;
            DeliverSystem deliver = new DeliverSystem();
            List<Organization> listOrgan = deliver.LoadDeliverBillsOwnOrgansByTimespan(startTime, endTime, LoginAccountId, LoginStaffName, out strErrText);
            if (listOrgan == null)
            {
                throw new Exception(strErrText);
            }

            var ret = from o in listOrgan
                      select new
                      {
                          Id = o.Id.ToString(),
                          FullName = o.FullName
                      };

            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
        public JsonResult LoadSearchDeliverBillsGrid(string sidx, string sord, int page, int rows, string startTime, string endTime, string customerName, string deliveryNo, string carNo)
        {
            //读取数据
            string strErrText;
            DeliverSystem deliver = new DeliverSystem();
            List<DeliverBill> listDeliverBill = deliver.LoadDeliverBillsByConditions(startTime, endTime, string.Empty, customerName, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, carNo, deliveryNo, string.Empty, "1", LoginAccountId, LoginStaffName, out strErrText);
            if (listDeliverBill == null)
            {
                throw new Exception(strErrText);
            }

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

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

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from b in data
                      select new
                      {
                          id = b.Id,
                          cell = new string[] {
                              b.Id.ToString(),
                              b.CreateTime.ToString("yyyy-MM-dd"),
                              b.DeliveryNo,
                              b.CarNo,
                              b.CustomerName,
                              b.ReceiverName,
                              b.ReceiverProvince + b.ReceiverCity + b.ReceiverAddress,
                              b.TotalPackages.ToString(),
                              b.TotalTunnages.ToString("#0.######"),
                              b.TotalPiles.ToString("#0.######"),
                              b.TotalTenThousands.ToString("#0.######"),
                              b.ContractNo,
                              b.OriginalContractNo,
                              b.TransportCharges.ToString()
                          }
                      }).ToArray(),
                userdata = new
                {
                    CreateTime = InnoSoft.LS.Resources.Labels.Total,
                    TotalPackages = data.Sum(s => s.TotalPackages),
                    TotalTunnages = data.Sum(s => s.TotalTunnages),
                    TotalPiles = data.Sum(s => s.TotalPiles),
                    TotalTenThousands = data.Sum(s => s.TotalTenThousands),
                    TransportCharges = data.Sum(s => s.TransportCharges)
                }
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 9
0
        public ActionResult ModifyShipmentBill(ShipmentBillViewModel model)
        {
            List<ShipmentBillGoods> listGoods = new List<ShipmentBillGoods>();
            foreach (ShipmentBillGoodsViewModel m in model.Goods)
            {
                ShipmentBillGoods g = new ShipmentBillGoods();
                g.Id = m.Id;
                g.ShipmentBillId = m.ShipmentBillId;
                g.GoodsId = m.GoodsId;
                g.GoodsName = m.GoodsName;
                g.GoodsNo = m.GoodsNo;
                g.Brand = m.Brand;
                g.SpecModel = m.SpecModel;
                g.GWeight = m.GWeight;
                g.Grade = m.Grade;
                g.PieceWeight = m.PieceWeight;
                g.Packing = m.Packing;
                g.BatchNo = m.BatchNo;
                g.Location = m.Location;
                g.Packages = m.Packages;
                g.Tunnages = m.Tunnages;
                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;
            DeliverSystem deliver = new DeliverSystem();
            if (deliver.UpdateShipmentBill(model.Id, model.TransportCharges, listGoods, LoginAccountId, LoginStaffName, out strErrText))
            {
                return Json(string.Empty);
            }
            else
            {
                return Json(strErrText);
            }
        }
Exemplo n.º 10
0
 public ActionResult ReceiptDeliverBill(string ids, string returnTime, string damageInfo)
 {
     string strErrText;
     DeliverSystem deliver = new DeliverSystem();
     foreach (string id in ids.Split(','))
     {
         if (!deliver.UpdateDeliverBillReceipt(long.Parse(id), DateTime.Parse(returnTime), damageInfo, LoginAccountId, LoginStaffName, out strErrText))
         {
             return Json(strErrText);
         }
     }
     return Json(string.Empty);
 }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
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);
        }
Exemplo n.º 13
0
        public JsonResult LoadSubmitShipmentBillsGrid(string sidx, string sord, int page, int rows, string carNo)
        {
            //读取数据
            string strErrText;
            DeliverSystem deliver = new DeliverSystem();
            List<ShipmentBill> listShipmentBill = deliver.LoadSubmitShipmentBills(LoginAccountId, LoginStaffName, out strErrText);
            if (listShipmentBill == null)
            {
                throw new Exception(strErrText);
            }

            if (carNo != null && carNo != string.Empty)
            {
                listShipmentBill = listShipmentBill.FindAll(delegate(ShipmentBill b) { return b.CarNo == carNo; });
            }

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

            string sortExpression = (sidx ?? "BillNo") + " " + (sord ?? "ASC");
            var data = listShipmentBill.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.BillNo,
                              p.CustomerName,
                              p.DeliveryNo,
                              p.ReceiverName,
                              p.CarNo,
                              p.TrailerNo,
                              p.TotalPackages.ToString(),
                              p.TotalTunnages.ToString("#0.######"),
                              p.TotalPiles.ToString("#0.######"),
                              p.TotalTenThousands.ToString("#0.######")
                          }
                      }).ToArray()
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 14
0
        public ActionResult ExportDeliverBillReceipts()
        {
            string strErrText;

            //提取查询条件
            var request = HttpContext.Request;
            string strStartTime = request.QueryString["startTime"] ?? string.Empty;
            string strEndTime = request.QueryString["endTime"] ?? string.Empty;
            string strCustomerName = request.QueryString["customerName"] ?? string.Empty;
            string strDeliveryNo = request.QueryString["deliveryNo"] ?? string.Empty;
            string strCarNo = request.QueryString["carNo"] ?? string.Empty;
            string strDestCountry = request.QueryString["destCountry"] ?? string.Empty;
            string strDestProvince = request.QueryString["destProvince"] ?? string.Empty;
            string strDestCity = request.QueryString["destCity"] ?? string.Empty;
            string strOrganId = request.QueryString["organId"] ?? string.Empty;

            //读取回单数据
            DeliverSystem deliver = new DeliverSystem();
            List<DeliverBill> listDeliverBill = deliver.LoadDeliverBillReceiptsByConditions(strStartTime, strEndTime, strCustomerName, strDeliveryNo, strCarNo,
                strDestCountry, strDestProvince, strDestCity, strOrganId, LoginAccountId, LoginStaffName, out strErrText);
            if (listDeliverBill == null)
            {
                throw new Exception(strErrText);
            }

            //生成GridView
            BoundField colDeliverBillNo = new BoundField();
            colDeliverBillNo.HeaderText = InnoSoft.LS.Resources.Labels.DeliverBillNo;
            colDeliverBillNo.DataField = "BillNo";

            BoundField colDeliverDate = new BoundField();
            colDeliverDate.HeaderText = InnoSoft.LS.Resources.Labels.DeliverDate;
            colDeliverDate.DataField = "CreateTime";

            BoundField colCustomerName = new BoundField();
            colCustomerName.HeaderText = InnoSoft.LS.Resources.Labels.CustomerName;
            colCustomerName.DataField = "CustomerName";

            BoundField colDeliveryNo = new BoundField();
            colDeliveryNo.HeaderText = InnoSoft.LS.Resources.Labels.DeliveryNo;
            colDeliveryNo.DataField = "DeliveryNo";

            BoundField colReceiverCity = new BoundField();
            colReceiverCity.HeaderText = InnoSoft.LS.Resources.Labels.DestPlace;
            colReceiverCity.DataField = "ReceiverCity";

            BoundField colReceiverName = new BoundField();
            colReceiverName.HeaderText = InnoSoft.LS.Resources.Labels.ReceiverName;
            colReceiverName.DataField = "ReceiverName";

            BoundField colCarNo = new BoundField();
            colCarNo.HeaderText = InnoSoft.LS.Resources.Labels.CarNo;
            colCarNo.DataField = "CarNo";

            BoundField colPackages = new BoundField();
            colPackages.HeaderText = InnoSoft.LS.Resources.Labels.Pieces;
            colPackages.DataField = "Packages";

            BoundField colTunnages = new BoundField();
            colTunnages.HeaderText = InnoSoft.LS.Resources.Labels.Tunnages;
            colTunnages.DataField = "Tunnages";

            BoundField colPiles = new BoundField();
            colPiles.HeaderText = InnoSoft.LS.Resources.Labels.Piles;
            colPiles.DataField = "Piles";

            BoundField colTenThousands = new BoundField();
            colTenThousands.HeaderText = InnoSoft.LS.Resources.Labels.TenThousands;
            colTenThousands.DataField = "TenThousands";

            BoundField colReturnTime = new BoundField();
            colReturnTime.HeaderText = InnoSoft.LS.Resources.Labels.ReturnTime;
            colReturnTime.DataField = "ReturnTime";

            BoundField colDamageInfo = new BoundField();
            colDamageInfo.HeaderText = InnoSoft.LS.Resources.Labels.DamageInfo;
            colDamageInfo.DataField = "DamageInfo";

            var grid = new GridView();
            grid.Columns.Add(colDeliverBillNo);
            grid.Columns.Add(colDeliverDate);
            grid.Columns.Add(colCustomerName);
            grid.Columns.Add(colDeliveryNo);
            grid.Columns.Add(colReceiverCity);
            grid.Columns.Add(colReceiverName);
            grid.Columns.Add(colCarNo);
            grid.Columns.Add(colPackages);
            grid.Columns.Add(colTunnages);
            grid.Columns.Add(colPiles);
            grid.Columns.Add(colTenThousands);
            grid.Columns.Add(colReturnTime);
            grid.Columns.Add(colDamageInfo);

            grid.AutoGenerateColumns = false;

            grid.DataSource = from bill in listDeliverBill
                              select new
                              {
                                  BillNo = bill.BillNo,
                                  CreateTime = bill.CreateTime.ToString("yyyy-MM-dd"),
                                  CustomerName = bill.CustomerName,
                                  DeliveryNo = bill.DeliveryNo,
                                  ReceiverCity = bill.ReceiverCity,
                                  ReceiverName = bill.ReceiverName,
                                  CarNo = bill.CarNo,
                                  Packages = bill.TotalPackages > 0 ? bill.TotalPackages.ToString() : string.Empty,
                                  Tunnages = bill.TotalTunnages > 0 ? bill.TotalTunnages.ToString("#0.######") : string.Empty,
                                  Piles = bill.TotalPiles > 0 ? bill.TotalPiles.ToString("#0.######") : string.Empty,
                                  TenThousands = bill.TotalTenThousands > 0 ? bill.TotalTenThousands.ToString("#0.######") : string.Empty,
                                  ReturnTime = bill.ReturnTime.ToString("yyyy-MM-dd"),
                                  DamageInfo = bill.DamageInfo
                              };
            grid.DataBind();

            //导出GridView
            Response.ClearContent();
            Response.Charset = InnoSoft.LS.Resources.Encoding.ExcelCharset;
            Response.ContentEncoding = System.Text.Encoding.GetEncoding(InnoSoft.LS.Resources.Encoding.ExcelContent);
            Response.ContentType = "application/ms-excel";
            Response.Write("<meta http-equiv=Content-Type content=text/html charset=" + InnoSoft.LS.Resources.Encoding.ExcelCharset + ">");
            Response.AddHeader("content-disposition", "attachment; filename=DeliverBillReceipts.xls");
            StringWriter sw = new StringWriter();
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            grid.RenderControl(htw);
            Response.Write(sw.ToString());
            Response.End();

            return View("SearchDeliverBillReceipts");
        }
Exemplo n.º 15
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);
        }
Exemplo n.º 16
0
        public JsonResult LoadSearchDeliverBillReceiptsGrid(string sidx, string sord, int page, int rows, string startTime, string endTime, string customerName, string deliveryNo,
            string carNo, string destCountry, string destProvince, string destCity, string organId)
        {
            //读取数据
            string strErrText;
            DeliverSystem deliver = new DeliverSystem();
            List<DeliverBill> listDeliverBill = deliver.LoadDeliverBillReceiptsByConditions(startTime, endTime, customerName, deliveryNo, carNo, destCountry,
                destProvince, destCity, organId, LoginAccountId, LoginStaffName, out strErrText);
            if (listDeliverBill == null)
            {
                throw new Exception(strErrText);
            }

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

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

            //生成表格数据
            var ret = new
            {
                total = nTotalPages,
                page = nPageIndex,
                records = nTotalRows,
                rows = (
                      from b in data
                      select new
                      {
                          id = b.Id,
                          cell = new string[] {
                              b.Id.ToString(),
                              b.BillNo,
                              b.CreateTime.ToString("yyyy-MM-dd"),
                              b.CustomerName,
                              b.DeliveryNo,
                              b.ReceiverCity,
                              b.ReceiverName,
                              b.CarNo,
                              b.TotalPackages.ToString(),
                              b.TotalTunnages.ToString("#0.######"),
                              b.TotalPiles.ToString("#0.######"),
                              b.TotalTenThousands.ToString("#0.######"),
                              b.ReturnTime.ToString("yyyy-MM-dd"),
                              b.DamageInfo
                          }
                      }).ToArray()
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 17
0
        public ActionResult ExportDeliverBills()
        {
            string strErrText;

            //提取查询条件
            var request = HttpContext.Request;
            string strStartTime = request.QueryString["startTime"] ?? string.Empty;
            string strEndTime = request.QueryString["endTime"] ?? string.Empty;
            string strCustomerName = request.QueryString["customerName"] ?? string.Empty;
            string strDeliveryNo = request.QueryString["deliveryNo"] ?? string.Empty;
            string strCarNo = request.QueryString["carNo"] ?? string.Empty;

            //读取回单数据
            DeliverSystem deliver = new DeliverSystem();
            List<DeliverBill> listDeliverBill = deliver.LoadDeliverBillsByConditions(strStartTime, strEndTime, string.Empty, strCustomerName, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, strCarNo, strDeliveryNo, string.Empty, "1", LoginAccountId, LoginStaffName, out strErrText);
            if (listDeliverBill == null)
            {
                throw new Exception(strErrText);
            }

            //生成GridView
            BoundField colCreateTime = new BoundField();
            colCreateTime.HeaderText = InnoSoft.LS.Resources.Labels.DeliverDate;
            colCreateTime.DataField = "CreateTime";

            BoundField colDeliveryNo = new BoundField();
            colDeliveryNo.HeaderText = InnoSoft.LS.Resources.Labels.DeliveryNo;
            colDeliveryNo.DataField = "DeliveryNo";

            BoundField colCarNo = new BoundField();
            colCarNo.HeaderText = InnoSoft.LS.Resources.Labels.CarNo;
            colCarNo.DataField = "CarNo";

            BoundField colCustomerName = new BoundField();
            colCustomerName.HeaderText = InnoSoft.LS.Resources.Labels.CustomerName;
            colCustomerName.DataField = "CustomerName";

            BoundField colReceiverName = new BoundField();
            colReceiverName.HeaderText = InnoSoft.LS.Resources.Labels.ReceiverName;
            colReceiverName.DataField = "ReceiverName";

            BoundField colReceiverAddress = new BoundField();
            colReceiverAddress.HeaderText = InnoSoft.LS.Resources.Labels.ReceiverAddress;
            colReceiverAddress.DataField = "ReceiverAddress";

            BoundField colTotalPackages = new BoundField();
            colTotalPackages.HeaderText = InnoSoft.LS.Resources.Labels.Pieces;
            colTotalPackages.DataField = "TotalPackages";

            BoundField colTotalTunnages = new BoundField();
            colTotalTunnages.HeaderText = InnoSoft.LS.Resources.Labels.Tunnages;
            colTotalTunnages.DataField = "TotalTunnages";

            BoundField colTotalPiles = new BoundField();
            colTotalPiles.HeaderText = InnoSoft.LS.Resources.Labels.Piles;
            colTotalPiles.DataField = "TotalPiles";

            BoundField colTotalTenThousands = new BoundField();
            colTotalTenThousands.HeaderText = InnoSoft.LS.Resources.Labels.TenThousands;
            colTotalTenThousands.DataField = "TotalTenThousands";

            BoundField colContractNo = new BoundField();
            colContractNo.HeaderText = InnoSoft.LS.Resources.Labels.ContractNo;
            colContractNo.DataField = "ContractNo";

            BoundField colOriginalContractNo = new BoundField();
            colOriginalContractNo.HeaderText = InnoSoft.LS.Resources.Labels.OriginalContractNo;
            colOriginalContractNo.DataField = "OriginalContractNo";

            BoundField colTransportCharges = new BoundField();
            colTransportCharges.HeaderText = InnoSoft.LS.Resources.Labels.TransportCharges;
            colTransportCharges.DataField = "TransportCharges";

            var grid = new GridView();
            grid.Columns.Add(colCreateTime);
            grid.Columns.Add(colDeliveryNo);
            grid.Columns.Add(colCarNo);
            grid.Columns.Add(colCustomerName);
            grid.Columns.Add(colReceiverName);
            grid.Columns.Add(colReceiverAddress);
            grid.Columns.Add(colTotalPackages);
            grid.Columns.Add(colTotalTunnages);
            grid.Columns.Add(colTotalPiles);
            grid.Columns.Add(colTotalTenThousands);
            grid.Columns.Add(colContractNo);
            grid.Columns.Add(colOriginalContractNo);
            grid.Columns.Add(colTransportCharges);

            grid.AutoGenerateColumns = false;

            grid.RowDataBound += new GridViewRowEventHandler(SearchDeliverBillsGrid_RowDataBound);
            grid.DataSource = from bill in listDeliverBill
                              select new
                              {
                                  CreateTime = bill.CreateTime.ToString("yyyy-MM-dd"),
                                  DeliveryNo = bill.DeliveryNo,
                                  CarNo = bill.CarNo,
                                  CustomerName = bill.CustomerName,
                                  ReceiverName = bill.ReceiverName,
                                  ReceiverAddress = bill.ReceiverProvince + bill.ReceiverCity + bill.ReceiverAddress,
                                  TotalPackages = bill.TotalPackages > 0 ? bill.TotalPackages.ToString() : string.Empty,
                                  TotalTunnages = bill.TotalTunnages > 0 ? bill.TotalTunnages.ToString("#0.######") : string.Empty,
                                  TotalPiles = bill.TotalPiles > 0 ? bill.TotalPiles.ToString("#0.######") : string.Empty,
                                  TotalTenThousands = bill.TotalTenThousands > 0 ? bill.TotalTenThousands.ToString("#0.######") : string.Empty,
                                  ContractNo = bill.ContractNo,
                                  OriginalContractNo = bill.OriginalContractNo,
                                  TransportCharges = bill.TransportCharges.ToString("N2")
                              };
            grid.DataBind();

            //导出GridView
            Response.ClearContent();
            Response.Charset = InnoSoft.LS.Resources.Encoding.ExcelCharset;
            Response.ContentEncoding = System.Text.Encoding.GetEncoding(InnoSoft.LS.Resources.Encoding.ExcelContent);
            Response.ContentType = "application/ms-excel";
            Response.Write("<meta http-equiv=Content-Type content=text/html charset=" + InnoSoft.LS.Resources.Encoding.ExcelCharset + ">");
            Response.AddHeader("content-disposition", "attachment; filename=DeliverBills.xls");
            StringWriter sw = new StringWriter();
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            grid.RenderControl(htw);
            Response.Write(@"<style> .text { mso-number-format:'\@'; } </style>");//定义字符串转换样式
            Response.Write(sw.ToString());
            Response.End();

            return View("SearchDeliverBills");
        }
Exemplo n.º 18
0
        public JsonResult LoadShipmentBillAllGoodsGrid(string sidx, string sord, int page, int rows, string shipmentBillId)
        {
            //读取数据
            string strErrText;
            DeliverSystem deliver = new DeliverSystem();
            List<ShipmentBillGoods> listGoods = deliver.LoadShipmentBillAllGoods(long.Parse(shipmentBillId), 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.Id.ToString(),
                              g.GoodsId.ToString(),
                              g.GoodsNo,
                              g.GoodsName,
                              g.Brand,
                              g.SpecModel,
                              g.GWeight,
                              g.Grade,
                              g.BatchNo,
                              g.Packing,
                              g.Warehouse,
                              g.Location,
                              g.Packages.ToString(),
                              g.PieceWeight.ToString("#0.######"),
                              g.Tunnages.ToString("#0.######"),
                              g.Piles.ToString("#0.######"),
                              g.TenThousands.ToString("#0.######"),
                              g.ProductionDate,
                              g.EnterWarehouseBillId.ToString(),
                              g.EnterWarehouseBillNo,
                              g.Location,
                              g.Packages.ToString(),
                              g.Tunnages.ToString("#0.######"),
                              g.Piles.ToString("#0.######"),
                              g.TenThousands.ToString("#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),
                }
            };
            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 19
0
        public ActionResult SubmitPrintDeliverBill(string id)
        {
            string strMessage;
            DeliverSystem deliver = new DeliverSystem();
            bool bSuccess = deliver.SubmitPrintDeliverBill(long.Parse(id), LoginAccountId, LoginStaffName, out strMessage);

            var ret = new
            {
                Success = bSuccess,
                Message = strMessage
            };
            return Json(ret);
        }
Exemplo n.º 20
0
        public JsonResult LoadDeliverBillByNo(string strDeliverBillNo)
        {
            string strErrText;
            DeliverSystem deliver = new DeliverSystem();
            DeliverBill data = deliver.LoadDeliverBillByNo(strDeliverBillNo, LoginAccountId, LoginStaffName, out strErrText);
            if (data == null)
            {
                return Json(null, JsonRequestBehavior.AllowGet);
            }
            else
            {
                var ret = new
                {
                    Id = data.Id,
                    PlanId = data.PlanId,
                    CarrierName = data.CarrierName,
                    CarNo = data.CarNo,
                    CarType = data.CarType,
                    TotalTunnages = data.TotalTunnages,
                    TotalPiles = data.TotalPiles,
                    ShipmentBillTotalTunnages = data.ShipmentBillTotalTunnages,
                    ShipmentBillTotalPiles = data.ShipmentBillTotalPiles,
                    TransportPrice = data.TransportPrice
                };

                return Json(ret, JsonRequestBehavior.AllowGet);
            }
        }
Exemplo n.º 21
0
 public ActionResult SubmitPrintShipmentBill(string id)
 {
     string strErrText;
     long nOutWarehouseBillId = 0;
     long nEnterWarehouseBillId = 0;
     DeliverSystem deliver = new DeliverSystem();
     bool bSuccess = deliver.SubmitPrintShipmentBill(long.Parse(id), out nOutWarehouseBillId, out nEnterWarehouseBillId, LoginAccountId, LoginStaffName, out strErrText);
     var ret = new
     {
         Success = bSuccess,
         ErrorMessage = strErrText,
         OutWarehouseBillId = nOutWarehouseBillId,
         EnterWarehouseBillId = nEnterWarehouseBillId
     };
     return Json(ret);
 }
Exemplo n.º 22
0
        public JsonResult LoadDeliverBillsPayersByTimespan(string startTime, string endTime)
        {
            string strErrText;
            DeliverSystem deliver = new DeliverSystem();
            List<Customer> listPayer = deliver.LoadDeliverBillsPayersByTimespan(startTime, endTime, LoginAccountId, LoginStaffName, out strErrText);
            if (listPayer == null)
            {
                throw new Exception(strErrText);
            }

            var ret = from p in listPayer
                      select new
                      {
                          Id = p.Id.ToString(),
                          Name = p.Name,
                          FullName = p.FullName
                      };

            return Json(ret, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 23
0
        public ActionResult ExportSyntheticalSearch()
        {
            string strErrText;

            #region 提取参数

            var request = HttpContext.Request;
            string strStartTime = request.QueryString["startTime"] ?? string.Empty;
            string strEndTime = request.QueryString["endTime"] ?? string.Empty;
            string strPayerName = request.QueryString["payerName"] ?? string.Empty;
            string strStartCountry = request.QueryString["startCountry"] ?? string.Empty;
            string strStartProvince = request.QueryString["startProvince"] ?? string.Empty;
            string strStartCity = request.QueryString["startCity"] ?? string.Empty;
            string strDestCountry = request.QueryString["destCountry"] ?? string.Empty;
            string strDestProvince = request.QueryString["destProvince"] ?? string.Empty;
            string strDestCity = request.QueryString["destCity"] ?? string.Empty;
            string strCarNo = request.QueryString["carNo"] ?? string.Empty;
            string strOrganId = request.QueryString["organId"] ?? string.Empty;

            #endregion

            #region 读取明细数据

            DeliverSystem deliver = new DeliverSystem();
            List<DeliverBill> listBill = deliver.LoadDeliverBillsByConditions(strStartTime, strEndTime, string.Empty, string.Empty, strPayerName, strStartCountry, strStartProvince, strStartCity, strDestCountry, strDestProvince, strDestCity, strCarNo, string.Empty, strOrganId, string.Empty, LoginAccountId, LoginStaffName, out strErrText);
            if (listBill == null)
            {
                throw new Exception(strErrText);
            }

            #endregion

            #region 根据结算公式计算运费
            {
                foreach (DeliverBill bill in listBill)
                {
                    if (bill.CustomerTransportCharges == 0 && bill.SettlementExpression != null && bill.SettlementExpression != string.Empty)
                    {
                        try
                        {
                            EvaluatorHelper evaluator = new EvaluatorHelper();

                            evaluator.SetExpression(bill.SettlementExpression);

                            evaluator.AddVariable(InnoSoft.LS.Resources.Labels.KM, bill.KM == null || bill.KM == string.Empty ? "0" : bill.KM);
                            evaluator.AddVariable(InnoSoft.LS.Resources.Labels.Tunnages, bill.TotalTunnages.ToString());
                            evaluator.AddVariable(InnoSoft.LS.Resources.Labels.Piles, bill.TotalPiles.ToString());
                            evaluator.AddVariable(InnoSoft.LS.Resources.Labels.TransportPrice, bill.CustomerTransportPrice.ToString());
                            evaluator.AddVariable(InnoSoft.LS.Resources.Labels.TransportCharges, "0");

                            string strTransportCharges = evaluator.EvaluateExpression();
                            bill.CustomerTransportCharges = decimal.Parse(strTransportCharges);
                        }
                        catch (Exception e)
                        {
                            throw e;
                        }
                    }
                }
            }
            #endregion

            #region 计算拼车费
            {
                var grpShipmentNos = listBill.GroupBy(s => s.ShipmentNo).OrderBy(s => s.Key);
                foreach (var grpShipmentNo in grpShipmentNos)
                {
                    if (grpShipmentNo.Key != null && grpShipmentNo.Key != string.Empty)
                    {
                        List<DeliverBill> listShipmentNoDetail = grpShipmentNo.ToList<DeliverBill>();

                        int i = 0;
                        while (i < listShipmentNoDetail.Count)
                        {
                            if (i > 0)
                            {
                                int j = 0;
                                while (j < i)
                                {
                                    if (listShipmentNoDetail[i].ReceiverAddress == listShipmentNoDetail[j].ReceiverAddress)
                                    {
                                        break;
                                    }
                                    j++;
                                }
                                if (j >= i)
                                {
                                    listShipmentNoDetail[i].CarpoolFee = 100;
                                }
                            }
                            i++;
                        }
                    }
                }
            }
            #endregion

            #region 输出Excel

            //生成GridView
            BoundField colCreateTime = new BoundField();
            colCreateTime.HeaderText = InnoSoft.LS.Resources.Labels.DeliverDate;
            colCreateTime.DataField = "CreateTime";

            BoundField colPlanNo = new BoundField();
            colPlanNo.HeaderText = InnoSoft.LS.Resources.Labels.PlanNo;
            colPlanNo.DataField = "PlanNo";

            BoundField colCustomerName = new BoundField();
            colCustomerName.HeaderText = InnoSoft.LS.Resources.Labels.CustomerName;
            colCustomerName.DataField = "CustomerName";

            BoundField colPayerName = new BoundField();
            colPayerName.HeaderText = InnoSoft.LS.Resources.Labels.PayerName;
            colPayerName.DataField = "PayerName";

            BoundField colShipmentNo = new BoundField();
            colShipmentNo.HeaderText = InnoSoft.LS.Resources.Labels.ShipmentNo;
            colShipmentNo.DataField = "ShipmentNo";

            BoundField colDeliveryNo = new BoundField();
            colDeliveryNo.HeaderText = InnoSoft.LS.Resources.Labels.DeliveryNo;
            colDeliveryNo.DataField = "DeliveryNo";

            BoundField colReceiverName = new BoundField();
            colReceiverName.HeaderText = InnoSoft.LS.Resources.Labels.ReceiverName;
            colReceiverName.DataField = "ReceiverName";

            BoundField colStartCity = new BoundField();
            colStartCity.HeaderText = InnoSoft.LS.Resources.Labels.StartPlace;
            colStartCity.DataField = "StartCity";

            BoundField colReceiverCity = new BoundField();
            colReceiverCity.HeaderText = InnoSoft.LS.Resources.Labels.DestPlace;
            colReceiverCity.DataField = "ReceiverCity";

            BoundField colReceiveType = new BoundField();
            colReceiveType.HeaderText = InnoSoft.LS.Resources.Labels.ReceiveType;
            colReceiveType.DataField = "ReceiveType";

            BoundField colGoodsName = new BoundField();
            colGoodsName.HeaderText = InnoSoft.LS.Resources.Labels.GoodsName;
            colGoodsName.DataField = "GoodsName";

            BoundField colTotalPackages = new BoundField();
            colTotalPackages.HeaderText = InnoSoft.LS.Resources.Labels.Pieces;
            colTotalPackages.DataField = "TotalPackages";

            BoundField colTotalTunnages = new BoundField();
            colTotalTunnages.HeaderText = InnoSoft.LS.Resources.Labels.Tunnages;
            colTotalTunnages.DataField = "TotalTunnages";

            BoundField colTotalPiles = new BoundField();
            colTotalPiles.HeaderText = InnoSoft.LS.Resources.Labels.Piles;
            colTotalPiles.DataField = "TotalPiles";

            BoundField colTotalTenThousands = new BoundField();
            colTotalTenThousands.HeaderText = InnoSoft.LS.Resources.Labels.TenThousands;
            colTotalTenThousands.DataField = "TotalTenThousands";

            BoundField colCarNo = new BoundField();
            colCarNo.HeaderText = InnoSoft.LS.Resources.Labels.CarNo;
            colCarNo.DataField = "CarNo";

            BoundField colTrailerNo = new BoundField();
            colTrailerNo.HeaderText = InnoSoft.LS.Resources.Labels.TrailerNo;
            colTrailerNo.DataField = "TrailerNo";

            BoundField colCarType = new BoundField();
            colCarType.HeaderText = InnoSoft.LS.Resources.Labels.CarType;
            colCarType.DataField = "CarType";

            BoundField colDeliverBillNo = new BoundField();
            colDeliverBillNo.HeaderText = InnoSoft.LS.Resources.Labels.DeliverBillNo;
            colDeliverBillNo.DataField = "BillNo";

            BoundField colContractNo = new BoundField();
            colContractNo.HeaderText = InnoSoft.LS.Resources.Labels.ContractNo;
            colContractNo.DataField = "ContractNo";

            BoundField colOriginalContractNo = new BoundField();
            colOriginalContractNo.HeaderText = InnoSoft.LS.Resources.Labels.OriginalContractNo;
            colOriginalContractNo.DataField = "OriginalContractNo";

            BoundField colCarrierTransportCharges = new BoundField();
            colCarrierTransportCharges.HeaderText = InnoSoft.LS.Resources.Labels.CarrierTransportCharges;
            colCarrierTransportCharges.DataField = "TransportCharges";

            BoundField colCustomerTransportCharges = new BoundField();
            colCustomerTransportCharges.HeaderText = InnoSoft.LS.Resources.Labels.CustomerTransportCharges;
            colCustomerTransportCharges.DataField = "CustomerTransportCharges";

            BoundField colTransportChargesDifference = new BoundField();
            colTransportChargesDifference.HeaderText = InnoSoft.LS.Resources.Labels.TransportChargesDifference;
            colTransportChargesDifference.DataField = "TransportChargesDifference";

            BoundField colIsCustomerTransportChargesSettled = new BoundField();
            colIsCustomerTransportChargesSettled.HeaderText = InnoSoft.LS.Resources.Labels.IsCustomerTransportChargesSettled;
            colIsCustomerTransportChargesSettled.DataField = "IsCustomerTransportChargesSettled";

            BoundField colIsCarrierTransportChargesSettled = new BoundField();
            colIsCarrierTransportChargesSettled.HeaderText = InnoSoft.LS.Resources.Labels.IsCarrierTransportChargesSettled;
            colIsCarrierTransportChargesSettled.DataField = "IsCarrierTransportChargesSettled";

            BoundField colIsDeliverBillReceiptReceived = new BoundField();
            colIsDeliverBillReceiptReceived.HeaderText = InnoSoft.LS.Resources.Labels.IsReceiptReceived;
            colIsDeliverBillReceiptReceived.DataField = "IsDeliverBillReceiptReceived";

            BoundField colReturnTime = new BoundField();
            colReturnTime.HeaderText = InnoSoft.LS.Resources.Labels.ReturnTime;
            colReturnTime.DataField = "ReturnTime";

            BoundField colReverseAmount = new BoundField();
            colReverseAmount.HeaderText = InnoSoft.LS.Resources.Labels.ReverseAmount;
            colReverseAmount.DataField = "ReverseAmount";

            BoundField colTransportChargesBalance = new BoundField();
            colTransportChargesBalance.HeaderText = InnoSoft.LS.Resources.Labels.TransportChargesBalance;
            colTransportChargesBalance.DataField = "TransportChargesBalance";

            BoundField colRemark = new BoundField();
            colRemark.HeaderText = InnoSoft.LS.Resources.Labels.Remark;
            colRemark.DataField = "Remark";

            var grid = new GridView();
            grid.Columns.Add(colCreateTime);
            grid.Columns.Add(colPlanNo);
            grid.Columns.Add(colCustomerName);
            grid.Columns.Add(colPayerName);
            grid.Columns.Add(colShipmentNo);
            grid.Columns.Add(colDeliveryNo);
            grid.Columns.Add(colReceiverName);
            grid.Columns.Add(colStartCity);
            grid.Columns.Add(colReceiverCity);
            grid.Columns.Add(colReceiveType);
            grid.Columns.Add(colGoodsName);
            grid.Columns.Add(colTotalPackages);
            grid.Columns.Add(colTotalTunnages);
            grid.Columns.Add(colTotalPiles);
            grid.Columns.Add(colTotalTenThousands);
            grid.Columns.Add(colCarNo);
            grid.Columns.Add(colTrailerNo);
            grid.Columns.Add(colCarType);
            grid.Columns.Add(colDeliverBillNo);
            grid.Columns.Add(colContractNo);
            grid.Columns.Add(colOriginalContractNo);
            grid.Columns.Add(colCarrierTransportCharges);
            grid.Columns.Add(colCustomerTransportCharges);
            grid.Columns.Add(colTransportChargesDifference);
            grid.Columns.Add(colIsCustomerTransportChargesSettled);
            grid.Columns.Add(colIsCarrierTransportChargesSettled);
            grid.Columns.Add(colIsDeliverBillReceiptReceived);
            grid.Columns.Add(colReturnTime);
            grid.Columns.Add(colReverseAmount);
            grid.Columns.Add(colTransportChargesBalance);
            grid.Columns.Add(colRemark);

            grid.AutoGenerateColumns = false;

            grid.RowDataBound += new GridViewRowEventHandler(SyntheticalSearchGrid_RowDataBound);
            grid.DataSource = from b in listBill
                              select new
                              {
                                  CreateTime = b.CreateTime.ToString("yyyy-MM-dd"),
                                  PlanNo = b.PlanNo,
                                  CustomerName = b.CustomerName,
                                  PayerName = b.PayerName,
                                  ShipmentNo = b.ShipmentNo,
                                  DeliveryNo = b.DeliveryNo,
                                  ReceiverName = b.ReceiverName,
                                  StartCity = b.StartCity,
                                  ReceiverCity = b.ReceiverCity,
                                  ReceiveType = b.ReceiveType,
                                  GoodsName = b.GoodsName,
                                  TotalPackages = b.TotalPackages != 0 ? b.TotalPackages.ToString() : string.Empty,
                                  TotalTunnages = b.TotalTunnages != 0 ? b.TotalTunnages.ToString("#0.######") : string.Empty,
                                  TotalPiles = b.TotalPiles != 0 ? b.TotalPiles.ToString("#0.######") : string.Empty,
                                  TotalTenThousands = b.TotalTenThousands != 0 ? b.TotalTenThousands.ToString("#0.######") : string.Empty,
                                  CarNo = b.CarNo,
                                  TrailerNo = b.TrailerNo,
                                  CarType = b.CarType,
                                  BillNo = b.BillNo,
                                  ContractNo = b.ContractNo,
                                  OriginalContractNo = b.OriginalContractNo,
                                  TransportCharges = b.TransportCharges != 0 ? b.TransportCharges.ToString("N") : string.Empty,
                                  CustomerTransportCharges = (b.CustomerTransportCharges + b.CarpoolFee + b.RiverCrossingCharges) != 0 ? (b.CustomerTransportCharges + b.CarpoolFee + b.RiverCrossingCharges).ToString("N") : string.Empty,
                                  TransportChargesDifference = (b.CustomerTransportCharges + b.CarpoolFee + b.RiverCrossingCharges - b.TransportCharges) != 0 ? (b.CustomerTransportCharges + b.CarpoolFee + b.RiverCrossingCharges - b.TransportCharges).ToString("N") : string.Empty,
                                  IsCustomerTransportChargesSettled = b.IsCustomerTransportChargesSettled ? InnoSoft.LS.Resources.Options.Yes : InnoSoft.LS.Resources.Options.No,
                                  IsCarrierTransportChargesSettled = b.IsCarrierTransportChargesSettled ? InnoSoft.LS.Resources.Options.Yes : InnoSoft.LS.Resources.Options.No,
                                  IsDeliverBillReceiptReceived = b.IsDeliverBillReceiptReceived ? InnoSoft.LS.Resources.Options.Yes : InnoSoft.LS.Resources.Options.No,
                                  ReturnTime = b.IsDeliverBillReceiptReceived ? b.ReturnTime.ToString("yyyy-MM-dd") : string.Empty,
                                  ReverseAmount = b.ReverseAmount != 0 ? b.ReverseAmount.ToString("N") : string.Empty,
                                  TransportChargesBalance = b.TransportChargesBalance != 0 ? b.TransportChargesBalance.ToString("N") : string.Empty,
                                  Remark = b.Remark
                              };
            grid.DataBind();

            //导出GridView
            Response.ClearContent();
            Response.Charset = InnoSoft.LS.Resources.Encoding.ExcelCharset;
            Response.ContentEncoding = System.Text.Encoding.GetEncoding(InnoSoft.LS.Resources.Encoding.ExcelContent);
            Response.ContentType = "application/ms-excel";
            Response.Write("<meta http-equiv=Content-Type content=text/html charset=" + InnoSoft.LS.Resources.Encoding.ExcelCharset + ">");
            Response.AddHeader("content-disposition", "attachment; filename=SyntheticalSearch.xls");
            StringWriter sw = new StringWriter();
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            grid.RenderControl(htw);
            Response.Write(sw.ToString());
            Response.End();

            #endregion

            return View("SyntheticalSearch");
        }