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 ActionResult DispatchNoodlePlan(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); } //读取发货计划起讫点的距离 int nKM = 0; DDSystem dd = new DDSystem(); ReceiverDistance distance = dd.LoadReceiverDistance(deliverPlan.ReceiverName, deliverPlan.StartCountry, deliverPlan.StartProvince, deliverPlan.StartCity, LoginAccountId, LoginStaffName, out strErrText); if (distance != null) { nKM = distance.KM; } //创建Model DispatchBillViewModel model = new DispatchBillViewModel(); model.CreateTime = DateTime.Now.ToString("yyyy-MM-dd"); model.DeliverPlans = new List<DispatchBillDeliverPlanViewModel>(); DispatchBillDeliverPlanViewModel modelDeliverPlan = new DispatchBillDeliverPlanViewModel(); modelDeliverPlan.PlanId = long.Parse(id); modelDeliverPlan.KM = nKM; model.DeliverPlans.Add(modelDeliverPlan); return View(model); }
public ActionResult DispatchOtherPlan(string id) { //创建Model DispatchBillViewModel model = new DispatchBillViewModel(); model.CreateTime = DateTime.Now.ToString("yyyy-MM-dd"); model.DeliverPlans = new List<DispatchBillDeliverPlanViewModel>(); DispatchBillDeliverPlanViewModel modelDeliverPlan = new DispatchBillDeliverPlanViewModel(); modelDeliverPlan.PlanId = long.Parse(id); model.DeliverPlans.Add(modelDeliverPlan); 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 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 NewDispatchBill() { //创建Model DispatchBillViewModel model = new DispatchBillViewModel(); model.CreateTime = DateTime.Now.ToString("yyyy-MM-dd"); model.DeliverPlans = new List<DispatchBillDeliverPlanViewModel>(); DispatchBillDeliverPlanViewModel modelDeliverPlan = new DispatchBillDeliverPlanViewModel(); model.DeliverPlans.Add(modelDeliverPlan); return View(model); }
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); }