Browse Source

文件归类。

master
yibo 7 years ago
parent
commit
73702b3dfe
7 changed files with 36 additions and 23 deletions
  1. +3
    -2
      ButcherFactory.BO/Utils/ButcherFactoryUtil.cs
  2. +3
    -3
      ButcherFactory.BO/Utils/XmlUtil.cs
  3. +0
    -4
      ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs
  4. +0
    -8
      ButcherFactory.Form/SegmentProduction_/SegmentProductionForm.cs
  5. +7
    -4
      ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs
  6. +10
    -0
      ButcherFactory.Login/App.xaml.cs
  7. +13
    -2
      ButcherFactorySolution/ButcherFactorySolution.vdproj

+ 3
- 2
ButcherFactory.BO/Utils/ButcherFactoryUtil.cs View File

@ -42,9 +42,10 @@ namespace ButcherFactory.BO.Utils
{
if (clientRpc != null)
return;
if (!File.Exists("MESUrl.cfg"))
var fileName = @"Config\MESUrl.cfg";
if (!File.Exists(fileName))
throw new Exception("缺少配置文件MESUrl.cfg");
var url = File.ReadAllText("MESUrl.cfg");
var url = File.ReadAllText(fileName);
if (string.IsNullOrEmpty(url))
throw new Exception("MESUrl.cfg 配置文件错误");
clientRpc = new ClientRpc(url);


+ 3
- 3
ButcherFactory.BO/Utils/XmlUtil.cs View File

@ -10,12 +10,12 @@ namespace ButcherFactory.BO.Utils
{
public static class XmlUtil
{
static string currentPath = Directory.GetCurrentDirectory();
static string config = "Config";
public static void SerializerObjToFile(object obj, string fileName = "")
{
if (string.IsNullOrWhiteSpace(fileName))
{
fileName = Path.Combine(currentPath, obj.GetType().Name + ".xml");
fileName = Path.Combine(config, obj.GetType().Name + ".xml");
}
var ser = new XmlSerializer(obj.GetType());
@ -30,7 +30,7 @@ namespace ButcherFactory.BO.Utils
{
if (string.IsNullOrWhiteSpace(fileName))
{
fileName = Path.Combine(currentPath, typeof(T).Name + ".xml");
fileName = Path.Combine(config, typeof(T).Name + ".xml");
}
if (!File.Exists(fileName))
{


+ 0
- 4
ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs View File

@ -42,12 +42,8 @@ namespace ButcherFactory.CarcassInStore_
long? batchID;
List<int> errorWeight = new List<int>();
string strErrorWeight = "";
string fileName;
public CarcassInStoreForm()
{
fileName = string.Format("{0:yyyyMMdd}WeightErrorLog.log", DateTime.Today);
if (!System.IO.File.Exists(fileName))
System.IO.File.Create(fileName);
InitializeComponent();
netStateWatch1.GetConnectState = () => LoginUtil.TestConnection(500);
this.FormClosing += delegate


+ 0
- 8
ButcherFactory.Form/SegmentProduction_/SegmentProductionForm.cs View File

@ -48,14 +48,6 @@ namespace ButcherFactory.SegmentProduction_
public SegmentProductionForm()
{
InitializeComponent();
if (!System.IO.Directory.Exists("TempImg"))
System.IO.Directory.CreateDirectory("TempImg");
else
{
var files = new System.IO.DirectoryInfo("TempImg").GetFiles();
foreach (var f in files)
f.Delete();
}
netStateWatch1.GetConnectState = () => LoginUtil.TestConnection(500);
this.FormClosing += delegate
{


+ 7
- 4
ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs View File

@ -11,6 +11,9 @@ namespace ButcherFactory.SegmentProduction_
public static class SegmentProductionPrint
{
static int id = 1;
const string PRINTFILE = @"PrintTemplate\SegmentProductionPrint.html";
const string ENDFILE = @"PrintTemplate\SegmentProductionPrintEnd.html";
const string IMGFILE = @"TempImg\_img{0}.png";
public static void Print(SegmentProduction entity, DateTime? dt)
{
if (dt == null)
@ -18,10 +21,10 @@ namespace ButcherFactory.SegmentProduction_
var dic = new Dictionary<string, string>();
dic.Add("$Goods_Name", entity.Goods_Name);
dic.Add("$Date", dt.Value.ToString("yyyy/MM/dd"));
var imgUrl = string.Format("TempImg\\_img{0}.png", id);
var imgUrl = string.Format(IMGFILE, id);
BwpClientPrint.BwpClientWebPrint.Create2DPic(entity.BarCode, imgUrl, 120);
dic.Add("$ImageUrl", imgUrl);
BwpClientPrint.BwpClientWebPrint.Print("PrintTemplate\\SegmentProductionPrint.html", dic);
BwpClientPrint.BwpClientWebPrint.Print(PRINTFILE, dic);
AfterPrint();
}
@ -47,11 +50,11 @@ namespace ButcherFactory.SegmentProduction_
var dic = new Dictionary<string, string>();
dic.Add("$tableContent", builder.ToString());
var groupID = list.First().GroupID.ToString();
var imgUrl = string.Format("TempImg\\_img{0}.png", id);
var imgUrl = string.Format(IMGFILE, id);
BwpClientPrint.BwpClientWebPrint.Create2DPic(groupID, imgUrl, 120);
dic.Add("$ImageUrl", imgUrl);
dic.Add("$DateTime", DateTime.Now.ToString("yyyy/MM/dd HH:ss"));
BwpClientPrint.BwpClientWebPrint.Print("PrintTemplate\\SegmentProductionPrintEnd.html", dic);
BwpClientPrint.BwpClientWebPrint.Print(ENDFILE, dic);
AfterPrint();
}


+ 10
- 0
ButcherFactory.Login/App.xaml.cs View File

@ -18,6 +18,8 @@ namespace ButcherFactory.Login
{
public EventWaitHandle ProgramStarted { get; set; }
readonly string[] FOLDERS = new string[] { "Config", "PrintTemplate", "Log", "TempImg" };
protected override void OnStartup(StartupEventArgs e)
{
bool createNew;
@ -35,6 +37,14 @@ namespace ButcherFactory.Login
RegisterEvents();
base.OnStartup(e);
foreach (var folder in FOLDERS)
{
if (!System.IO.Directory.Exists(folder))
System.IO.Directory.CreateDirectory(folder);
}
var tempImages = new System.IO.DirectoryInfo("TempImg").GetFiles();
foreach (var f in tempImages)
f.Delete();
}
///<summary>


+ 13
- 2
ButcherFactorySolution/ButcherFactorySolution.vdproj View File

@ -533,7 +533,7 @@
"SourcePath" = "8:..\\ButcherFactory.Login\\bin\\Debug\\DbSelectList.xml"
"TargetName" = "8:DbSelectList.xml"
"Tag" = "8:"
"Folder" = "8:_A4535DAA71C54DC088A3FA09FCED8C88"
"Folder" = "8:_DDF0E5520C37445FBCDCE0D5082C076B"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Vital" = "11:TRUE"
@ -1176,7 +1176,7 @@
"SourcePath" = "8:..\\ButcherFactory.Login\\bin\\Debug\\MESUrl.cfg"
"TargetName" = "8:MESUrl.cfg"
"Tag" = "8:"
"Folder" = "8:_A4535DAA71C54DC088A3FA09FCED8C88"
"Folder" = "8:_DDF0E5520C37445FBCDCE0D5082C076B"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Vital" = "11:TRUE"
@ -1302,6 +1302,17 @@
{
}
}
"{9EF0B969-E518-4E46-987F-47570745A589}:_DDF0E5520C37445FBCDCE0D5082C076B"
{
"Name" = "8:Config"
"AlwaysCreate" = "11:FALSE"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Property" = "8:_557ADC8EE8A04B99876F388F4924E380"
"Folders"
{
}
}
}
}
"{1525181F-901A-416C-8A58-119130FE478E}:_ABD60611E8FE4923AC9AD915648E417C"


Loading…
Cancel
Save