diff --git a/BO/BO.csproj b/BO/BO.csproj index ad34972..19cc73f 100644 --- a/BO/BO.csproj +++ b/BO/BO.csproj @@ -55,6 +55,7 @@ + diff --git a/BO/BO/Bill/GradeAndWeight/DetailLastIndex.cs b/BO/BO/Bill/GradeAndWeight/DetailLastIndex.cs new file mode 100644 index 0000000..e176e70 --- /dev/null +++ b/BO/BO/Bill/GradeAndWeight/DetailLastIndex.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BO.BO.Bill +{ + public class DetailLastIndex + { + public int Index { get; set; } + } +} diff --git a/BO/Utils/AfterLoginUtil.cs b/BO/Utils/AfterLoginUtil.cs index 2016978..00b76e1 100644 --- a/BO/Utils/AfterLoginUtil.cs +++ b/BO/Utils/AfterLoginUtil.cs @@ -19,13 +19,13 @@ namespace BO.Utils public static class AfterLoginUtil { - // static List> roleToAssemblies = new List>(){new Tuple("排宰员",@"C:\BwpB3Project\src\B3ButcherManageClient\ButcherOrder\bin\Debug\ButcherOrder"), - //new Tuple("过磅员",@"C:\BwpB3Project\src\B3ButcherManageClient\ButcherWeight\bin\Debug\ButcherWeight"), - // new Tuple("验质员",@"C:\BwpB3Project\src\B3ButcherManageClient\QualityAndOrder\bin\Debug\QualityAndOrder"),new Tuple("定级员",@"C:\BwpB3Project\src\B3ButcherManageClient\WeighAndGrading\bin\Debug\WeighAndGrading"),new Tuple("窒晕员",@"C:\BwpB3Project\src\B3ButcherManageClient\OrderConfirm\bin\Debug\OrderConfirm")}; + static List> roleToAssemblies = new List>(){new Tuple("排宰员",@"C:\BwpB3Project\src\B3ButcherManageClient\ButcherOrder\bin\Debug\ButcherOrder"), + new Tuple("过磅员",@"C:\BwpB3Project\src\B3ButcherManageClient\ButcherWeight\bin\Debug\ButcherWeight"), + new Tuple("验质员",@"C:\BwpB3Project\src\B3ButcherManageClient\QualityAndOrder\bin\Debug\QualityAndOrder"),new Tuple("定级员",@"C:\BwpB3Project\src\B3ButcherManageClient\WeighAndGrading\bin\Debug\WeighAndGrading"),new Tuple("窒晕员",@"C:\BwpB3Project\src\B3ButcherManageClient\OrderConfirm\bin\Debug\OrderConfirm")}; - static List> roleToAssemblies = new List>(){new Tuple("排宰员",@"ButcherOrder"), - new Tuple("过磅员",@"ButcherWeight"), - new Tuple("验质员",@"QualityAndOrder"),new Tuple("定级员",@"WeighAndGrading"),new Tuple("窒晕员",@"OrderConfirm")}; + //static List> roleToAssemblies = new List>(){new Tuple("排宰员",@"ButcherOrder"), + //new Tuple("过磅员",@"ButcherWeight"), + // new Tuple("验质员",@"QualityAndOrder"),new Tuple("定级员",@"WeighAndGrading"),new Tuple("窒晕员",@"OrderConfirm")}; public static Form CreateForm(string role) @@ -34,10 +34,10 @@ namespace BO.Utils if (first == null) throw new Exception("未注册的角色"); //#if debug - // var filePath = string.Format("{0}.dll", first.Item2); + var filePath = string.Format("{0}.dll", first.Item2); //#endif //#if !debug - var filePath = Path.Combine(Application.StartupPath, string.Format("{0}.dll", first.Item2)); + //var filePath = Path.Combine(Application.StartupPath, string.Format("{0}.dll", first.Item2)); //#endif if (!File.Exists(filePath)) throw new Exception("相关模块不存在"); diff --git a/BO/Utils/ButcherAppContext.cs b/BO/Utils/ButcherAppContext.cs index d79120c..d133932 100644 --- a/BO/Utils/ButcherAppContext.cs +++ b/BO/Utils/ButcherAppContext.cs @@ -24,7 +24,7 @@ namespace BO.Utils set; } - private ButcherAppContext() + public ButcherAppContext() { UrlConfig = new ServerUrlConfig(); UserConfig = new LoginUserInfo(); diff --git a/BO/Utils/LoginRpcUtil.cs b/BO/Utils/LoginRpcUtil.cs index c50db0a..e29fb4c 100644 --- a/BO/Utils/LoginRpcUtil.cs +++ b/BO/Utils/LoginRpcUtil.cs @@ -3,6 +3,7 @@ using Forks.JsonRpc.Client.Data; using System; using System.Collections.Generic; using System.Linq; +using System.Net; using System.Text; using System.Threading.Tasks; @@ -43,5 +44,23 @@ namespace BO.Utils userInfo.Role = obj.Get("Role"); } } + + public static bool TestConnection() + { + var url = ButcherAppContext.Context.UrlConfig.ServerUrl; + if (string.IsNullOrEmpty(url)) + return false; + try + { + HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); + HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); + + return resp.StatusCode == HttpStatusCode.OK; + } + catch + { + return false; + } + } } } diff --git a/BO/Utils/LoginUserInfo.cs b/BO/Utils/LoginUserInfo.cs index 86d94e7..e1ee625 100644 --- a/BO/Utils/LoginUserInfo.cs +++ b/BO/Utils/LoginUserInfo.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Xml.Serialization; namespace BO.Utils { @@ -27,5 +28,11 @@ namespace BO.Utils public string Employee_Name { get; set; } public string Role { get; set; } + + [XmlIgnore] + public bool Connection { get; set; } + + [XmlIgnore] + public string PWD { get; set; } } } diff --git a/BO/Utils/XmlUtil.cs b/BO/Utils/XmlUtil.cs index 38c65fd..01cd6e6 100644 --- a/BO/Utils/XmlUtil.cs +++ b/BO/Utils/XmlUtil.cs @@ -16,6 +16,7 @@ namespace BO.Utils { fileName = obj.GetType().Name + ".xml"; } + var ser = new XmlSerializer(obj.GetType()); using (var stream = File.Open(fileName, FileMode.Create)) { @@ -24,6 +25,7 @@ namespace BO.Utils } public static T DeserializeFromFile(string fileName = "") + where T : new() { if (string.IsNullOrWhiteSpace(fileName)) { @@ -31,7 +33,7 @@ namespace BO.Utils } if (!File.Exists(fileName)) { - throw new FileNotFoundException("不存在文件:" + fileName); + return new T(); } using (var reader = new StreamReader(fileName)) { diff --git a/BWP.WinFormControl/BWP.WinFormControl.csproj b/BWP.WinFormControl/BWP.WinFormControl.csproj index 88501a9..af7c412 100644 --- a/BWP.WinFormControl/BWP.WinFormControl.csproj +++ b/BWP.WinFormControl/BWP.WinFormControl.csproj @@ -120,6 +120,10 @@ WeightControl.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WeighAndGrading/WeighAndGrading.csproj b/WeighAndGrading/WeighAndGrading.csproj index 7e9f985..cddb1a0 100644 --- a/WeighAndGrading/WeighAndGrading.csproj +++ b/WeighAndGrading/WeighAndGrading.csproj @@ -70,6 +70,11 @@ GradeSettingFrom.cs + + True + True + Resources.resx + @@ -82,6 +87,10 @@ GradeSettingFrom.cs + + ResXFileCodeGenerator + Resources.Designer.cs +