Example #1
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);
            }
        }
Example #2
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 #3
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);
        }