public ActionResult ModifyDeliverBill(DeliverBillViewModel model) { List<DeliverBillGoods> listGoods = new List<DeliverBillGoods>(); foreach (DeliverBillGoodsViewModel m in model.Goods) { DeliverBillGoods g = new DeliverBillGoods(); g.Id = m.Id; g.DeliverBillId = m.DeliverBillId; 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.UpdateDeliverBill(model.Id, model.TransportCharges, listGoods, LoginAccountId, LoginStaffName, out strErrText)) { return Json(string.Empty); } else { return Json(strErrText); } }
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); }
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); }