From 924bdf1c9fb74babf2438d5545db3594756625d1 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 22 六月 2020 20:06:39 +0800 Subject: [PATCH] '完善信息' --- WindowsFormsApp1/utils/DocUtil.cs | 31 +++++++++++++++++++++++++++++-- 1 files changed, 29 insertions(+), 2 deletions(-) diff --git a/WindowsFormsApp1/utils/DocUtil.cs b/WindowsFormsApp1/utils/DocUtil.cs index 535cb25..45aab3e 100644 --- a/WindowsFormsApp1/utils/DocUtil.cs +++ b/WindowsFormsApp1/utils/DocUtil.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Data.Entity; using System.Text; +using System.Windows.Forms; using WindowsFormsApp1.entity; using WindowsFormsApp1.utils; @@ -13,7 +14,19 @@ public static List<FirstOrderSubInfo> ydGoodsList=new List<FirstOrderSubInfo>(); public static List<FirstOrderSubInfo> spGoodsList = new List<FirstOrderSubInfo>(); + public static void Clear() { + ydGoodsList.Clear(); + spGoodsList.Clear(); + } + public static void AddYDGoods(FirstOrderSubInfo info) { + + if (ydGoodsList != null && ydGoodsList.Count > 0) + { + if (ydGoodsList[0].LijinAmount != info.LijinAmount) { + MessageBox.Show("寮曞崟搴撶殑绀奸噾闈㈤蹇呴』涓�鑷�"); + } + } foreach (FirstOrderSubInfo i in ydGoodsList) { if (i.GoodsId == info.GoodsId) return; @@ -120,6 +133,8 @@ if (config == null) { config = SQLiteDataBaseUtil.getInstance().GetConfig("sdlj_doc_template"); } + if (config == null) + return ""; String template = config.Value; @@ -135,14 +150,26 @@ ydSt.Append("\r\n"); } + if (ydGoodsList.Count > 0) { + + } + StringBuilder spSt = new StringBuilder(); for (int i = 0; i < spGoodsList.Count; i++) { - spSt.Append(sts[1].Replace("{瀹炴媿鍟嗗搧鍒版墜浠穧", spGoodsList[i].ActualPrice).Replace("{瀹炴媿鍟嗗搧鏍囬}", spGoodsList[i].Title).Replace("{瀹炴媿鍟嗗搧閾炬帴}", spGoodsList[i].ItemUrl).Replace("{瀹炴媿鍟嗗搧鍙d护}", spGoodsList[i].Tkl) + "\r\n"); + spSt.Append(sts[1].Replace("{瀹炴媿鍟嗗搧鍒版墜浠穧", spGoodsList[i].ActualPrice).Replace("{瀹炴媿鍟嗗搧鏍囬}", spGoodsList[i].Title).Replace("{瀹炴媿鍟嗗搧閾炬帴}", spGoodsList[i].ItemUrl).Replace("{瀹炴媿鍟嗗搧鍙d护}", spGoodsList[i].Tkl)); + if (i < spGoodsList.Count - 1) + spSt.Append("\r\n"); } - return template.Replace("[" + sts[0] + "]", ydSt.ToString()).Replace("[" + sts[1] + "]", spSt.ToString()); + template= template.Replace("[" + sts[0] + "]", ydSt.ToString()).Replace("[" + sts[1] + "]", spSt.ToString()); + if (ydGoodsList.Count > 0) + { + template = template.Replace("{寮曞崟绀奸噾闈㈤}", ydGoodsList[0].LijinAmount); + } + + return template; } } } -- Gitblit v1.8.0