public ActionResult DeleteDispatchBill(string id) { string strErrText; DispatchSystem dispatch = new DispatchSystem(); if (dispatch.DeleteDispatchBill(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText)) { return Json(string.Empty); } else { return Json(strErrText); } }
public JsonResult LoadContractDispatchBillDeliverPlansGrid(string sidx, string sord, int page, int rows, string dispatchBillId) { //读取数据 string strErrText; DispatchSystem dispatch = new DispatchSystem(); List<DispatchBillDeliverPlan> listDeliverPlan = dispatch.LoadDispatchBillDeliverPlans(long.Parse(dispatchBillId), LoginAccountId, LoginStaffName, out strErrText); if (listDeliverPlan == null) { throw new Exception(strErrText); } //清除自提的计划 listDeliverPlan.RemoveAll(delegate(DispatchBillDeliverPlan p) { return p.ReceiveType == InnoSoft.LS.Resources.Options.PickUpSelf; }); //提取当前页面数据 int nTotalRows = listDeliverPlan.Count; int nPageIndex = page; int nPageSize = rows; int nTotalPages = nTotalRows / nPageSize; if (nTotalRows % nPageSize > 0) nTotalPages++; string sortExpression = (sidx ?? "PlanNo") + " " + (sord ?? "ASC"); var data = listDeliverPlan.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.PlanId.ToString(), p.PlanNo, p.CustomerName, p.ShipmentNo, p.DeliveryNo, p.ReceiverName, p.ReceiverCity + p.ReceiverAddress, p.ReceiveType, p.PlanType, p.Packages.ToString(), p.Tunnages.ToString("#0.######"), p.Piles.ToString("#0.######"), p.TenThousands.ToString("#0.######"), p.TransportPrice.ToString("#0.######"), p.TransportCharges.ToString(), p.Remark, p.TransportChargeExpression, p.TransportPriceExpression, p.KM.ToString() } }).ToArray(), userdata = new { PlanNo = 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), TransportCharges = data.Sum(s => s.TransportCharges) } }; return Json(ret, JsonRequestBehavior.AllowGet); }
public JsonResult LoadContractDispatchBill(string dispatchBillId) { string strErrText; //读取调度单数据 DispatchSystem dispatch = new DispatchSystem(); DispatchBill bill = dispatch.LoadDispatchBill(long.Parse(dispatchBillId), LoginAccountId, LoginStaffName, out strErrText); if (bill == null) { throw new Exception(strErrText); } //读取调度计划数据 List<DispatchBillDeliverPlan> listDeliverPlan = dispatch.LoadDispatchBillDeliverPlans(long.Parse(dispatchBillId), LoginAccountId, LoginStaffName, out strErrText); if (listDeliverPlan == null) { throw new Exception(strErrText); } //读取调度货物数据 List<DispatchBillGoods> listGoods = dispatch.LoadDispatchBillAllGoods(long.Parse(dispatchBillId), LoginAccountId, LoginStaffName, out strErrText); if (listGoods == null) { throw new Exception(strErrText); } //清除自提的计划 foreach (DispatchBillDeliverPlan p in listDeliverPlan) { if (p.ReceiveType == InnoSoft.LS.Resources.Options.PickUpSelf) { listGoods.RemoveAll(delegate(DispatchBillGoods g) { return g.PlanId == p.PlanId; }); } } listDeliverPlan.RemoveAll(delegate(DispatchBillDeliverPlan p) { return p.ReceiveType == InnoSoft.LS.Resources.Options.PickUpSelf; }); //生成结果集 var ret = new { CarNo = bill.CarNo, TrailerNo = bill.TrailerNo, CarType = bill.CarType, DriverName = bill.DriverName, DriverLicenseNo = bill.DriverLicenseNo, DriverMobileTel = bill.DriverMobileTel, DriverHomeTel = bill.DriverHomeTel, CarrierId = bill.CarrierId, CarrierName = bill.CarrierName, GoodsName = (from g in listGoods select g.GoodsName).Distinct(), Packing = "", TotalPackages = listDeliverPlan.Sum(p => p.Packages), TotalTunnages = listDeliverPlan.Sum(p => p.Tunnages).ToString("#0.######"), TotalPiles = listDeliverPlan.Sum(p => p.Piles).ToString("#0.######"), TotalTenThousands = listDeliverPlan.Sum(p => p.TenThousands).ToString("#0.######"), StartPlace = (from p in listDeliverPlan select p.StartCity).Distinct(), DestPlace = (from p in listDeliverPlan select p.ReceiverCity).Distinct(), ShipmentTime = DateTime.Now.ToString("yyyy-MM-dd"), ArrivalTime = "", TotalTransportCharges = listDeliverPlan.Sum(p => p.TransportCharges).ToString("#0.00"), PrepayTransportCharges = "", ResidualTransportCharges = listDeliverPlan.Sum(p => p.TransportCharges).ToString("#0.00"), OriginalContractNo = "" }; return Json(ret, JsonRequestBehavior.AllowGet); }
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); }
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); }
public JsonResult LoadDispatchBillDeliverPlan(string dispatchBillId, string planId) { string strErrText; DispatchSystem dispatch = new DispatchSystem(); DispatchBillDeliverPlan data = dispatch.LoadDispatchBillDeliverPlan(long.Parse(dispatchBillId), long.Parse(planId), LoginAccountId, LoginStaffName, out strErrText); if (data == null) { return Json(null, JsonRequestBehavior.AllowGet); } else { var ret = new { TransportChargeExpression = data.TransportChargeExpression, TransportPriceExpression = data.TransportPriceExpression, KM = data.KM, TransportPrice = data.TransportPrice, TransportCharges = data.TransportCharges, Remark = data.Remark }; return Json(ret, JsonRequestBehavior.AllowGet); } }
public JsonResult LoadDispatchOtherPlanGoodsGrid(string sidx, string sord, int page, int rows, string planId) { //读取数据 string strErrText; DispatchSystem dispatch = new DispatchSystem(); List<DispatchBillGoods> listGoods = dispatch.LoadDispatchDeliverPlanAllGoods(long.Parse(planId), 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(); //记录编号 for (int i = 0; i < data.Count; i++) { data[i].Id = i + 1; } //生成表格数据 var ret = new { total = nTotalPages, page = nPageIndex, records = nTotalRows, rows = ( from g in data select new { id = g.Id, cell = new string[] { g.GoodsId.ToString(), g.GoodsNo, g.GoodsName, g.SpecModel, g.Packages.ToString(), g.Tunnages.ToString("#0.######"), "0", "0" } }).ToArray(), userdata = new { GoodsNo = InnoSoft.LS.Resources.Labels.Total, Packages = data.Sum(s => s.Packages), Tunnages = data.Sum(s => s.Tunnages), ActualPackages = 0, ActualTunnages = 0 } }; return Json(ret, JsonRequestBehavior.AllowGet); }
public ActionResult DispatchPaperPlan(string id) { string strErrText; //读取发货计划数据 PlanSystem plan = new PlanSystem(); DeliverPlan deliverPlan = plan.LoadDeliverPlan(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText); if (deliverPlan == null) { throw new Exception(strErrText); } //如果是配送 if (deliverPlan.ReceiveType == InnoSoft.LS.Resources.Options.PickUpDelivery) { //创建Model DispatchBillViewModel model = new DispatchBillViewModel(); model.CreateTime = DateTime.Now.ToString("yyyy-MM-dd"); model.DeliverPlans = new List<DispatchBillDeliverPlanViewModel>(); DispatchBillDeliverPlanViewModel modelDeliverPlan = new DispatchBillDeliverPlanViewModel(); modelDeliverPlan.PlanId = deliverPlan.Id; model.DeliverPlans.Add(modelDeliverPlan); return View(model); } //如果是自提 else { //创建Model DispatchBillViewModel model = new DispatchBillViewModel(); model.CreateTime = DateTime.Now.ToString("yyyy-MM-dd"); //读取车号是否已有调度单 DispatchSystem dispatch = new DispatchSystem(); DispatchBill dispatchBill = dispatch.LoadSubmitDispatchBillByCarNo(deliverPlan.CarNo, LoginAccountId, LoginStaffName, out strErrText); if (dispatchBill != null) { model.CarNo = dispatchBill.CarNo; model.TrailerNo = dispatchBill.TrailerNo; model.DriverName = dispatchBill.DriverName; model.DriverLicenseNo = dispatchBill.DriverLicenseNo; model.DriverMobileTel = dispatchBill.DriverMobileTel; model.DriverHomeTel = dispatchBill.DriverHomeTel; model.CarrierId = dispatchBill.CarrierId; model.CarrierName = dispatchBill.CarrierName; model.CarryingCapacity = dispatchBill.CarryingCapacity; //读取承运单位信息 DDSystem dd = new DDSystem(); Carrier carrier = dd.LoadCarrier(dispatchBill.CarrierId, LoginAccountId, LoginStaffName, out strErrText); if (carrier != null) { model.BusinessType = carrier.BusinessType; model.PaymentType = carrier.PaymentType; } } else { model.CarNo = deliverPlan.CarNo; model.TrailerNo = deliverPlan.TrailerNo; model.DriverName = deliverPlan.DriverName; model.DriverLicenseNo = deliverPlan.DriverLicenseNo; model.DriverMobileTel = deliverPlan.DriverMobileTel; model.DriverHomeTel = deliverPlan.DriverHomeTel; model.CarrierId = deliverPlan.CarrierId; model.CarrierName = deliverPlan.CarrierName; //读取车辆载重 DDSystem dd = new DDSystem(); CarrierCar car = dd.LoadCarByCarNo(deliverPlan.CarNo, LoginAccountId, LoginStaffName, out strErrText); if (car != null) { model.CarryingCapacity = car.CarryingCapacity; } //读取承运单位信息 Carrier carrier = dd.LoadCarrierByCarNo(deliverPlan.CarNo, LoginAccountId, LoginStaffName, out strErrText); if (carrier != null) { model.CarrierId = carrier.Id; model.CarrierName = carrier.Name; model.BusinessType = carrier.BusinessType; model.PaymentType = carrier.PaymentType; } } model.DeliverPlans = new List<DispatchBillDeliverPlanViewModel>(); DispatchBillDeliverPlanViewModel modelDeliverPlan = new DispatchBillDeliverPlanViewModel(); modelDeliverPlan.PlanId = deliverPlan.Id; model.DeliverPlans.Add(modelDeliverPlan); return View(model); } }
public JsonResult LoadCanPlanGoodsDispatchHistoryGrid(string sidx, string sord, int page, int rows, string planId, string goodsId) { string strErrText; //读取数据 DispatchSystem dispatch = new DispatchSystem(); List<DispatchBillGoods> listGoods = dispatch.LoadAllDispatchBillGoodsByConditions(planId, goodsId, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, 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 ?? "CreateTime") + " " + (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.CreateTime.ToString("yyyy-MM-dd"), g.CarNo, g.TrailerNo, g.Piles.ToString("#0.######"), g.TenThousands.ToString("#0.######") } }).ToArray(), userdata = new { CreateTime = InnoSoft.LS.Resources.Labels.Total, Piles = data.Sum(s => s.Piles), TenThousands = data.Sum(s => s.TenThousands) } }; return Json(ret, JsonRequestBehavior.AllowGet); }
public ActionResult SubmitDispatchBill(string id) { string strErrText; //读取调度单数据 DispatchSystem dispatch = new DispatchSystem(); DispatchBill data = dispatch.LoadDispatchBill(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText); if (data == null) { throw new Exception(strErrText); } //创建Model DispatchBillViewModel model = new DispatchBillViewModel(); model.Id = data.Id; 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.CarryingCapacity = data.CarryingCapacity; model.BusinessType = data.BusinessType; model.PaymentType = data.PaymentType; model.CreateTime = data.CreateTime.ToString("yyyy-MM-dd"); return View(model); }
public ActionResult SubmitDispatchBill(DispatchBillViewModel model) { string strMessage; DispatchSystem dispatch = new DispatchSystem(); bool bSuccess = dispatch.SubmitDispatchBill(model.Id, LoginAccountId, LoginStaffName, out strMessage); var ret = new { Success = bSuccess, Message = strMessage }; return Json(ret); }
public ActionResult ModifyDispatchedPlan(DispatchBillViewModel model) { if (ModelState.IsValid) { //创建调度计划数据 int nTotalPackages = 0; decimal decTotalTunnages = 0; decimal decTotalPiles = 0; decimal decTotalTenThousands = 0; decimal decTotalTransportCharges = 0; List<DispatchBillDeliverPlan> listDeliverPlan = new List<DispatchBillDeliverPlan>(); if (model.DeliverPlans != null) { foreach (DispatchBillDeliverPlanViewModel m in model.DeliverPlans) { DispatchBillDeliverPlan deliverPlan = new DispatchBillDeliverPlan(); deliverPlan.DispatchBillId = model.Id; deliverPlan.PlanId = m.PlanId; deliverPlan.Packages = m.Packages; deliverPlan.Tunnages = m.Tunnages; deliverPlan.Piles = m.Piles; deliverPlan.TenThousands = m.TenThousands; deliverPlan.TransportChargeExpression = m.TransportChargeExpression; deliverPlan.TransportPriceExpression = m.TransportPriceExpression; deliverPlan.KM = m.KM; deliverPlan.TransportPrice = m.ActualTransportPrice; deliverPlan.TransportCharges = m.TransportCharges; deliverPlan.Remark = m.Remark; listDeliverPlan.Add(deliverPlan); nTotalPackages += m.Packages; decTotalTunnages += m.Tunnages; decTotalPiles += m.Piles; decTotalTenThousands += m.TenThousands; decTotalTransportCharges += m.TransportCharges; } } //创建调度货物数据 List<DispatchBillGoods> listGoods = new List<DispatchBillGoods>(); if (model.Goods != null) { foreach (DispatchBillGoodsViewModel m in model.Goods) { DispatchBillGoods goods = new DispatchBillGoods(); goods.DispatchBillId = model.Id; goods.PlanId = m.PlanId; goods.GoodsId = m.GoodsId; goods.GoodsNo = m.GoodsNo; goods.GoodsName = m.GoodsName; goods.Brand = m.Brand; goods.SpecModel = m.SpecModel; goods.GWeight = m.GWeight; goods.Grade = m.Grade; goods.PieceWeight = m.PieceWeight; goods.Packing = m.Packing; goods.BatchNo = m.BatchNo; goods.Location = m.Location; goods.Packages = m.Packages; goods.Tunnages = m.Tunnages; goods.Piles = m.Piles; goods.TenThousands = m.TenThousands; goods.ProductionDate = m.ProductionDate; goods.EnterWarehouseBillId = m.EnterWarehouseBillId; goods.EnterWarehouseBillNo = m.EnterWarehouseBillNo; listGoods.Add(goods); } } //创建调度单数据 DispatchBill bill = new DispatchBill(); bill.Id = model.Id; bill.CarNo = model.CarNo; bill.TrailerNo = model.TrailerNo; bill.CarType = model.CarType; bill.DriverName = model.DriverName; bill.DriverLicenseNo = model.DriverLicenseNo; bill.DriverMobileTel = model.DriverMobileTel; bill.DriverHomeTel = model.DriverHomeTel; bill.CarrierId = model.CarrierId; bill.CarrierName = model.CarrierName; bill.CarryingCapacity = model.CarryingCapacity; bill.BusinessType = model.BusinessType; bill.PaymentType = model.PaymentType; bill.TotalPackages = nTotalPackages; bill.TotalTunnages = decTotalTunnages; bill.TotalPiles = decTotalPiles; bill.TotalTenThousands = decTotalTenThousands; bill.TotalTransportCharges = decTotalTransportCharges; bill.CreateTime = DateTime.Parse(model.CreateTime); //保存数据 string strErrText; DispatchSystem dispatch = new DispatchSystem(); if (dispatch.UpdateDispatchBill(bill, listDeliverPlan, listGoods, LoginAccountId, LoginStaffName, out strErrText)) { return Json(string.Empty); } else { return Json(strErrText); } } return View(model); }
public ActionResult ModifyDispatchBill(DispatchBillViewModel model) { if (ModelState.IsValid) { //创建调度单数据 DispatchBill data = new DispatchBill(); data.Id = model.Id; data.CarNo = model.CarNo; data.TrailerNo = model.TrailerNo; data.CarType = model.CarType; data.DriverName = model.DriverName; data.DriverLicenseNo = model.DriverLicenseNo; data.DriverMobileTel = model.DriverMobileTel; data.DriverHomeTel = model.DriverHomeTel; data.CarrierId = model.CarrierId; data.CarrierName = model.CarrierName; data.CarryingCapacity = model.CarryingCapacity; data.BusinessType = model.BusinessType; data.PaymentType = model.PaymentType; data.CreateTime = DateTime.Parse(model.CreateTime); List<DispatchBillDeliverPlan> listPlan = new List<DispatchBillDeliverPlan>(); foreach (DispatchBillDeliverPlanViewModel m in model.DeliverPlans) { DispatchBillDeliverPlan p = new DispatchBillDeliverPlan(); p.PlanId = m.PlanId; p.ReceiveType = m.ReceiveType; listPlan.Add(p); } //保存数据 string strErrText; DispatchSystem dispatch = new DispatchSystem(); if (dispatch.UpdateDispatchBill(data, listPlan, LoginAccountId, LoginStaffName, out strErrText)) { return Json(string.Empty); } else { return Json(strErrText); } } return View(model); }
public JsonResult MergeDispatchBills(string ids) { //保存数据 string strMessage = string.Empty; bool bShipmentBillMerged = false; bool bDeliverBillMerged = false; DispatchSystem dispatch = new DispatchSystem(); long nNewDispatchBillId = dispatch.MergeDispatchBills(ids, LoginAccountId, LoginStaffName, out bShipmentBillMerged, out bDeliverBillMerged, out strMessage); var ret = new { DispatchBillId = nNewDispatchBillId, ShipmentBillMerged = bShipmentBillMerged, DeliverBillMerged = bDeliverBillMerged, Message = strMessage }; return Json(ret); }
public JsonResult LoadContractDispatchBillsGrid(string sidx, string sord, int page, int rows) { string strErrText; //读取可以新增合同的车号数据 DispatchSystem dispatch = new DispatchSystem(); List<DispatchBill> listBill = dispatch.LoadContractDispatchBills(LoginAccountId, LoginStaffName, out strErrText); if (listBill == null) { throw new Exception(strErrText); } //提取当前页面数据 int nTotalRows = listBill.Count; int nPageIndex = page; int nPageSize = rows; int nTotalPages = nTotalRows / nPageSize; if (nTotalRows % nPageSize > 0) nTotalPages++; string sortExpression = (sidx ?? "CarNo") + " " + (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.CarNo, b.TrailerNo, b.DriverName, b.DriverMobileTel, b.TotalPackages.ToString(), b.TotalTunnages.ToString("#0.######"), b.TotalPiles.ToString("#0.######"), b.TotalTenThousands.ToString("#0.######"), b.CreateTime.ToString("yyyy-MM-dd") } }).ToArray() }; return Json(ret, JsonRequestBehavior.AllowGet); }
public JsonResult LoadDispatchBillByCarNo(string strCarNo) { string strErrText; DispatchSystem dispatch = new DispatchSystem(); DispatchBill data = dispatch.LoadSubmitDispatchBillByCarNo(strCarNo, LoginAccountId, LoginStaffName, out strErrText); if (data == null) { return Json(null, JsonRequestBehavior.AllowGet); } else { var ret = new { CarType = data.CarType, DriverName = data.DriverName, DriverLicenseNo = data.DriverLicenseNo, DriverMobileTel = data.DriverMobileTel, DriverHomeTel = data.DriverHomeTel }; return Json(ret, JsonRequestBehavior.AllowGet); } }
public JsonResult LoadContractGoodsGrid(string sidx, string sord, int page, int rows, string contractId, string planId) { //读取数据 string strErrText; DispatchSystem dispatch = new DispatchSystem(); List<DispatchBillGoods> listGoods = dispatch.LoadDispatchBillAllGoodsByContractIdAndPlanId(long.Parse(contractId), long.Parse(planId), 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(); //记录编号 for (int i = 0; i < data.Count; i++) { data[i].Id = i + 1; } //生成表格数据 var ret = new { total = nTotalPages, page = nPageIndex, records = nTotalRows, rows = ( from g in data select new { id = g.Id, cell = new string[] { g.GoodsId.ToString(), g.GoodsNo, g.GoodsName, g.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 } }).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); }
public JsonResult LoadDispatchedPaperPlansGrid(string sidx, string sord, int page, int rows, string carNo) { //读取数据 string strErrText; DispatchSystem dispatch = new DispatchSystem(); List<DispatchBillDeliverPlan> listPlan = dispatch.LoadDispatchBillDeliverPlansByCarNo(carNo, LoginAccountId, LoginStaffName, out strErrText); if (listPlan == null) { throw new Exception(strErrText); } //提取当前页面数据 int nTotalRows = listPlan.Count; int nPageIndex = page; int nPageSize = rows; int nTotalPages = nTotalRows / nPageSize; if (nTotalRows % nPageSize > 0) nTotalPages++; string sortExpression = (sidx ?? "PlanNo") + " " + (sord ?? "ASC"); var data = listPlan.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList(); //生成表格数据 var ret = new { total = nTotalPages, page = nPageIndex, records = nTotalRows, rows = ( from p in data select new { id = p.Id, cell = new string[] { p.Id.ToString(), p.PlanNo, p.CustomerName, p.ShipmentNo, p.DeliveryNo, p.ReceiverName, p.ReceiverCity, p.PlanType, p.Tunnages.ToString("#0.######"), p.TransportPrice.ToString("#0.######"), p.TransportCharges.ToString(), p.Remark } }).ToArray(), userdata = new { PlanNo = InnoSoft.LS.Resources.Labels.Total, Tunnages = data.Sum(s => s.Tunnages), TransportCharges = data.Sum(s => s.TransportCharges) } }; return Json(ret, JsonRequestBehavior.AllowGet); }