public TruckLoadForm(TruckLoad load) { InitializeComponent(); this.TruckLoad = load; listViewItems.Resize += delegate { columnHeader2.Width = listViewItems.Width - 22 - (columnHeader1.Width + columnHeader3.Width + columnHeader4.Width + columnHeader5.Width + columnHeader6.Width + columnHeader7.Width); }; newToolStripMenuItem.Click += delegate { if (ItemAdding != null) { ItemAdding(new TruckLoadItem(), null); } }; editToolStripMenuItem.Click += delegate { if (listViewItems.SelectedItems.Count > 0) { using (TruckLoadItemForm f = new TruckLoadItemForm(load.Items[listViewItems.SelectedItems[0].Index])) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { LoadItemsChanged(this, null); } } } }; listViewItems.DoubleClick += delegate { editToolStripMenuItem.PerformClick(); }; deleteToolStripMenuItem.Click += delegate { if (listViewItems.SelectedItems.Count > 0) { load.RemoveItem(load.Items[listViewItems.SelectedItems[0].Index]); } }; }
public string Format(TruckLoad load) { return(string.Format( "TRUCK LOAD" + Environment.NewLine + "Date: {0}" + Environment.NewLine + "Salesman: {1}" + Environment.NewLine + "Route: {2}" + Environment.NewLine + "Reference No: {10}" + Environment.NewLine + "Customer: {8}" + Environment.NewLine + Environment.NewLine + "Code Description Unit Qty Price Disc Amount" + Environment.NewLine + "--------------------------------------------------------------------------------------" + Environment.NewLine + "{3}" + "--------------------------------------------------------------------------------------" + Environment.NewLine + " {7} {9} {6}" + Environment.NewLine + Environment.NewLine + "Prepared By: {4} Approved By: {5}", load.Date.ToString(), load.SalesRep.Name, load.Route.Code, GetPrintableDetails(load), load.PreparedBy, load.ApprovedBy, load.TotalAmount.ToString("###,##0.00").PadLeft(9), load.TotalQuantity.ToString("###,##0.00").PadLeft(8), load.Customer.Name, load.TotalDiscount.ToString("###,##0.00").PadLeft(8), load.Id )); }
public void Print(TruckLoad load) { if (printer != null && formatter != null) { printer.Print(formatter.Format(load)); } }
public ActionResult Close(TruckLoad tl) { try { tl.hasError = false; // TODO: Add insert logic here if ((tl.TrailerID == null) || (tl.TrailerID == "")) { tl.hasError = true; TempData["message"] = "Trailer Missing"; } else { string ret = tl.closeTrailer(); TempData["message"] = ret; if (!ret.Contains("Success")) { tl.hasError = false; tl.hasError = true; tl.TrailerID = ""; } } TempData["load"] = tl; return(RedirectToAction("Create")); } catch { return(View()); } }
public ActionResult Create(TruckLoad tl) { try { tl.hasError = false; // TODO: Add insert logic here string message = tl.store(); TempData["message"] = message; TempData["load"] = tl; if (message.Contains("Success")) { return(RedirectToAction("Create", "Scan")); } else { tl.hasError = true; TempData["load"] = tl; return(RedirectToAction("Create")); } } catch { return(View()); } }
/// <summary> /// 验证撤销装车数量并提交处理过程ValidateQty /// </summary> /// <param name="model"></param> /// <returns></returns> public ActionResult ValidateQty(TruckLoad model) { GetLoginInfo(); if (Login_Info == null) { return(Content("<script>location.href='/Home'</script>")); } service = new TruckLoadService(Login_Info.User_ID, Login_Info.User_Name, Login_Info.Token); try { service.SetParameter("PaperNO", model.PaperNO); service.SetParameter("StoreNO", model.StoreNO); service.SetParameter("TrayNO", model.TrayNO); service.SetParameter("NewTrayNO", model.NewTrayNO); service.SetParameter("Barcode", model.Barcode); service.SetParameter("AQty", model.AQty); service.SetParameter("IsFirst", model.IsFirst); service.ExecuteBusinessCheck("RF_TruckMath", "*"); service.ExecuteBusinessProcess("RF_TruckMath"); return(Content("")); } catch (Exception ex) { Loger.Error(ex); return(Content(ex.Message)); } }
/// <summary> /// 验证撤销装车输入的条码ValidateBarcode /// </summary> /// <param name="model"></param> /// <returns></returns> public ActionResult ValidateBarcode(TruckLoad model) { GetLoginInfo(); if (Login_Info == null) { return(Content("<script>location.href='/Home'</script>")); } service = new TruckLoadService(Login_Info.User_ID, Login_Info.User_Name, Login_Info.Token); try { service.SetParameter("PaperNO", model.PaperNO); service.SetParameter("StoreNO", model.StoreNO); service.SetParameter("TrayNO", model.TrayNO); service.SetParameter("NewTrayNO", model.NewTrayNO); service.SetParameter("Barcode", model.Barcode); service.SetParameter("IsFirst", model.IsFirst); service.ExecuteBusinessCheck("RF_TruckMath", "Barcode"); DataTable dt = service.GetBarcodeGoods(); if (dt == null || dt.Rows.Count <= 0) { return(Content("获取商品信息异常,请重试!")); } else { return(Content(JsonHelper.ToJson(dt))); } } catch (Exception ex) { Loger.Error(ex); return(Content(ex.Message)); } }
void ViewReportToolStripMenuItemClick(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { TruckLoad t = loads[listView1.SelectedItems[0].Index]; new ViewTruckLoadByRefNoReport(t.Id).Run(); } }
void ViewSalesReportPerItemToolStripMenuItemClick(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { TruckLoad t = loads[listView1.SelectedItems[0].Index]; new ViewSalesReportPerItem(t).Run(); } }
public ActionResult Create(TruckLoad tl) { try { tl.hasError = false; // TODO: Add insert logic here if ((tl.TrailerID == null) || (tl.TrailerID == "")) { tl.hasError = true; TempData["message"] = "Trailer Missing"; } else { string ret = tl.checkTrailer(); TempData["message"] = ret; if (!ret.Contains("Success")) { tl.hasError = true; tl.TrailerID = ""; } } if (!(tl.LawTag == null)) { Lawtag lt = new Lawtag(); lt.TagNum = tl.LawTag; lt.TrailerID = tl.TrailerID; string ltmessage = lt.store(); TempData["message"] = ltmessage; if (ltmessage.Contains("already")) { if (tl.LawTagDelete == "yes") { lt.delete(); tl.LawTagStatus = "none"; tl.LawTagDelete = "no"; tl.LawTag = null; TempData["message"] = "Removed"; } else { tl.LawTagStatus = "already"; } } else { tl.LawTag = null; } } TempData["load"] = tl; return(RedirectToAction("Create")); } catch { return(View()); } }
void UndoToolStripMenuItemClick(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { foreach (ListViewItem li in listView1.SelectedItems) { TruckLoad t = loads[li.Index]; DeleteTruckLoad(t, null); } OnActivated(null); } }
// GET: Scan/Create public ActionResult Create() { TruckLoad tl = new TruckLoad(); if (!(TempData["load"] == null)) { tl = (TruckLoad)TempData["load"]; } if (!(TempData["message"] == null)) { ViewBag.Message = TempData["message"].ToString(); } return(View(tl)); }
// GET: Load/Create public ActionResult Create() { TruckLoad tl = new TruckLoad(); tl.Ship_Date = DateTime.Today.AddDays(1); if (!(TempData["load"] == null)) { tl = (TruckLoad)TempData["load"]; } if (!(TempData["message"] == null)) { ViewBag.Message = TempData["message"].ToString(); } return(View(tl)); }
void CloseToolStripMenuItemClick(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { using (AdminPasswordForm f = new AdminPasswordForm()) { if (WorkbenchSingleton.AddDialog(f) == DialogResult.OK) { foreach (ListViewItem li in listView1.SelectedItems) { TruckLoad t = loads[li.Index]; CloseTruckLoad(t, null); } OnActivated(null); } } } }
public void TestMethod() { TruckLoad load1 = new TruckLoad(); load1.Customer = new Customer(); load1.AddItem(new TruckLoadItem(new Item() { Name = "Item A", SalesPrice = 10 }, 1)); load1.AddItem(new TruckLoadItem(new Item() { Name = "Item B", SalesPrice = 10 }, 2)); TruckLoad load2 = new TruckLoad(); load2.Customer = new Customer(); load2.AddItem(new TruckLoadItem(new Item() { Name = "Item A", SalesPrice = 10 }, 1)); TruckReturn ret = new TruckReturn(); foreach (var l in new TruckLoad[] { load1, load2 }) { foreach (var i in l.Items) { Console.WriteLine(i.Quantity + " " + i.Item.Name + ", " + i.Amount); ret.AddItem(i); } } ret.Items[0].Quantity = 1; Console.WriteLine("Printing truck return..."); foreach (var i in ret.Items) { Console.WriteLine(i.Quantity + " " + i.Item.Name + ", " + i.Amount); } // ITruckReturnService service = new DummyTruckReturnService(); // service.SaveOrUpdate(ret); }
string GetPrintableDetails(TruckLoad load) { string text = ""; foreach (var i in SortItems(load)) { text += string.Format( "{0} {1} {2} {3} {4} {6} {5}" + Environment.NewLine, i.Item.Name.Length < 12 ? i.Item.Name.PadRight(12) : (i.Item.Name.Substring(0, 9) + "...").PadRight(12), i.Item.SalesDescription.Length < 21 ? i.Item.SalesDescription.PadRight(21) : (i.Item.SalesDescription.Substring(0, 18) + "...").PadRight(21), i.Item.UnitMeasure.Length < 11 ? i.Item.UnitMeasure.PadRight(11) : (i.Item.UnitMeasure.Substring(0, 8) + "...").PadRight(11), i.Quantity.ToString("0.00").PadLeft(5), i.Price.ToString("0.00").PadLeft(8), i.Amount.ToString("0.00").PadLeft(9), i.Discount.ToString("0.00").PadLeft(8) ); } return(text); }
public static void Map(LMYFrameWorkMVCEntities dbContext, TruckLoad src, TruckLoadModel dest) { if (src == null || dest == null) { return; } dest.CopyPropertyValues(src); dest.ToDateString = src.ToDate.ToStringDateFormat(); dest.FromDateString = src.FromDate.ToStringDateFormat(); if (src.Truck != null) { dest.TruckModel.CopyPropertyValues(src.Truck); } if (src.Driver != null) { dest.DriverModel.CopyPropertyValues(src.Driver); } if (src.Company != null) { dest.CompanyModel.CopyPropertyValues(src.Company); } if (src.TruckLoadStatus != null) { dest.StatusModel.CopyPropertyValues(src.TruckLoadStatus); } if (src.USAState != null) { dest.FromStateModel.CopyPropertyValues(src.USAState); } if (src.USAState1 != null) { dest.ToStateModel.CopyPropertyValues(src.USAState1); } }
/// <summary> /// 验证车牌号 /// </summary> /// <param name="model"></param> /// <returns></returns> public ActionResult ValidateTruckNO(TruckLoad model) { GetLoginInfo(); if (Login_Info == null) { return(Content("<script>location.href='/Home'</script>")); } service = new TruckLoadService(Login_Info.User_ID, Login_Info.User_Name, Login_Info.Token); try { service.SetParameter("PaperNO", model.PaperNO); service.SetParameter("StoreNO", model.StoreNO); service.SetParameter("TruckNO", model.TruckNO); service.ExecuteBusinessCheck("RF_LoadingAdd", "TruckNO"); return(Content("")); } catch (Exception ex) { Loger.Error(ex); return(Content(ex.Message)); } }
IList <TruckLoadItem> SortItems(TruckLoad load) { IList <TruckLoadItem> nonEmpties = new List <TruckLoadItem>(); IList <TruckLoadItem> empties = new List <TruckLoadItem>(); foreach (TruckLoadItem item in load.Items) { if (ItemUtility.IsEmpty(item.Item.Name)) { empties.Add(item); } else { nonEmpties.Add(item); } } IList <TruckLoadItem> items = new List <TruckLoadItem>(nonEmpties); foreach (TruckLoadItem i in empties) { items.Add(i); } return(items); }
public static void Map(LMYFrameWorkMVCEntities dbContext, TruckLoadModel src, TruckLoad dest) { if (src == null || dest == null) { return; } dest.CopyPropertyValues(src); if (!string.IsNullOrEmpty(src.FromDateString)) { dest.FromDate = src.FromDateString.ConvertToDateTime(); } if (!string.IsNullOrEmpty(src.ToDateString)) { dest.ToDate = src.ToDateString.ConvertToDateTime(); } dest.TotalIncome = dest.Price; dest.TotalCosts = dest.DriverCost + dest.FuelCost + dest.OtherCosts; dest.TotalProfit = dest.TotalIncome - dest.TotalCosts; }
public ViewSalesReportPerItem(TruckLoad load) { this.load = load; }
public void SaveOrUpdate(TruckLoad t) { dao.SaveOrUpdate(t); }
public void Delete(TruckLoad t) { dao.Delete(t); }
public EditTruckLoad(TruckLoad load) { this.load = load; }