diff --git a/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs b/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs index 05c9352..e81680e 100644 --- a/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs +++ b/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs @@ -169,7 +169,7 @@ namespace ButcherFactory.BO.LocalBL var json = RpcFacade.Call(RpcPath + "CheckInStored", JsonConvert.SerializeObject(codeArr)); return JsonConvert.DeserializeObject>(json); } - catch (Exception ex) + catch { #if DEBUG throw; @@ -248,11 +248,11 @@ namespace ButcherFactory.BO.LocalBL session.Commit(); } } - catch - { + catch + { #if DEBUG throw; -#endif +#endif } } @@ -272,7 +272,7 @@ namespace ButcherFactory.BO.LocalBL query.Columns.Add(DQSelectColumn.Field("StandardPic")); query.Columns.Add(DQSelectColumn.Field("MsgID")); query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Submited", true), DQCondition.EQ("Sync", false), DQCondition.EQ("Delete", false))); - query.Where.Conditions.Add(DQCondition.LessThan("CreateTime", DateTime.Now.AddMinutes(-1))); + //query.Where.Conditions.Add(DQCondition.LessThan("CreateTime", DateTime.Now.AddMinutes(-1))); query.Range = SelectRange.Top(10); query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID")); diff --git a/ButcherFactory.Login/Login.xaml.cs b/ButcherFactory.Login/Login.xaml.cs index eb1de30..61b71e1 100644 --- a/ButcherFactory.Login/Login.xaml.cs +++ b/ButcherFactory.Login/Login.xaml.cs @@ -134,7 +134,7 @@ namespace ButcherFactory.Login void Login_Loaded(object sender, RoutedEventArgs e) { - AutoUpdate(); + //AutoUpdate(); } } } diff --git a/SelfHelpClient/ItemSelect.cs b/SelfHelpClient/ItemSelect.cs index 5822eff..99a51c1 100644 --- a/SelfHelpClient/ItemSelect.cs +++ b/SelfHelpClient/ItemSelect.cs @@ -14,11 +14,9 @@ namespace SelfHelpClient public partial class ItemSelect : Template { List list; - ReadCardForm form; - public ItemSelect(List mlist, ReadCardForm mForm) + public ItemSelect(List mlist) { InitializeComponent(); - form = mForm; list = mlist; this.WindowState = FormWindowState.Maximized; } @@ -34,9 +32,11 @@ namespace SelfHelpClient private void uDataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) - return; - form.VEntity = uDataGridView1.CurrentRow.DataBoundItem as ViewEntity; - DialogResult = DialogResult.OK; + return; + Program.ve = uDataGridView1.CurrentRow.DataBoundItem as ViewEntity; + //MessageBox.Show((form.VEntity != null).ToString()); + //DialogResult = DialogResult.OK; + this.Close(); } private void backBtn_Click(object sender, EventArgs e) diff --git a/SelfHelpClient/ItemSelect2.cs b/SelfHelpClient/ItemSelect2.cs index fbf9dac..b174974 100644 --- a/SelfHelpClient/ItemSelect2.cs +++ b/SelfHelpClient/ItemSelect2.cs @@ -33,7 +33,7 @@ namespace SelfHelpClient { if (e.RowIndex < 0) return; - form.VEntity = uDataGridView1.CurrentRow.DataBoundItem as ViewEntity; + Program.ve = uDataGridView1.CurrentRow.DataBoundItem as ViewEntity; DialogResult = DialogResult.OK; } diff --git a/SelfHelpClient/MainForm.cs b/SelfHelpClient/MainForm.cs index 0e8a42f..9dbfc56 100644 --- a/SelfHelpClient/MainForm.cs +++ b/SelfHelpClient/MainForm.cs @@ -1,14 +1,16 @@ -using SelfHelpClient.BL; -using SelfHelpClient.BO; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Text; -using System.Windows.Forms; +using SelfHelpClient.BL; +using SelfHelpClient.BO; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Windows.Forms; +using System.Windows.Input; namespace SelfHelpClient { @@ -28,43 +30,82 @@ namespace SelfHelpClient } WeightBillBL.ServerUrl = File.ReadAllText("AppConfig.cfg"); mForm = this; - InitializeComponent(); + InitializeComponent(); + DisableWPFTabletSupport(); } private void selfBtn_Click(object sender, EventArgs e) { - var entity = ReadCard(); - if (entity == null) - return; - if (entity.BillType == 0) + ReadCard(); + if (Program.ve == null) + return; + if (Program.ve.BillType == 0) { DialogForm.ShowDialog("没有待办理业务", 5); return; - } - new SelfHelpForm(entity.ID).ShowDialog(); + } + new SelfHelpForm(Program.ve.ID).ShowDialog(); //this.Hide(); } private void weightBtn_Click(object sender, EventArgs e) { - var entity = ReadCard(); - if (entity == null) - return; - new WeightForm(entity).Show(); + ReadCard(); + if (Program.ve == null) + return; + new WeightForm(Program.ve).Show(); this.Hide(); } - ViewEntity ReadCard() - { - var reader = new ReadCardForm(); - if (reader.ShowDialog() == DialogResult.OK) - return reader.VEntity; - return null; ; + void ReadCard() + { + Program.ve = null; + var reader = new ReadCardForm(); + reader.ShowDialog(); } private void closeBtn_Click(object sender, EventArgs e) { this.Close(); + } + + public static void DisableWPFTabletSupport() + { + // Get a collection of the tablet devices for this window. + var devices = System.Windows.Input.Tablet.TabletDevices; + + if (devices.Count > 0) + { + // Get the Type of InputManager. + Type inputManagerType = typeof(System.Windows.Input.InputManager); + + // Call the StylusLogic method on the InputManager.Current instance. + object stylusLogic = inputManagerType.InvokeMember("StylusLogic", + BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic, + null, InputManager.Current, null); + + if (stylusLogic != null) + { + // Get the type of the device class. + Type devicesType = devices.GetType(); + + // Loop until there are no more devices to remove. + int count = devices.Count + 1; + + while (devices.Count > 0) + { + // Remove the first tablet device in the devices collection. + devicesType.InvokeMember("HandleTabletRemoved", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.NonPublic, null, devices, new object[] { (uint)0 }); + + count--; + + if (devices.Count != count) + { + throw new Win32Exception("Unable to remove real-time stylus support."); + } + } + } + } } } } diff --git a/SelfHelpClient/Program.cs b/SelfHelpClient/Program.cs index 075d091..88e2f45 100644 --- a/SelfHelpClient/Program.cs +++ b/SelfHelpClient/Program.cs @@ -1,6 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; +using SelfHelpClient.BO; +using System; +using System.Collections.Generic; +using System.Linq; using System.Windows.Forms; namespace SelfHelpClient @@ -16,6 +17,8 @@ namespace SelfHelpClient Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); - } + } + + public static ViewEntity ve { get; set; } } } diff --git a/SelfHelpClient/ReadCardForm.cs b/SelfHelpClient/ReadCardForm.cs index 0854da1..5a1dabb 100644 --- a/SelfHelpClient/ReadCardForm.cs +++ b/SelfHelpClient/ReadCardForm.cs @@ -13,35 +13,50 @@ using System.Windows.Forms; namespace SelfHelpClient { public partial class ReadCardForm : Template - { - string _cardNumber = ""; - public ViewEntity VEntity { get; set; } + { + string _cardNumber = ""; + BrushIdCard mBrushIdCard; public ReadCardForm() { InitializeComponent(); - this.WindowState = FormWindowState.Maximized; - this.KeyPress += ReadCardForm_KeyPress; + this.WindowState = FormWindowState.Maximized; + this.KeyPress += ReadCardForm_KeyPress; + mBrushIdCard = new BrushIdCard(MBrushIdCard_StatusChanged, MBrushIdCard_IdCardBrushed); + } + private void MBrushIdCard_StatusChanged(object sender, IdCardStatusChangeEventArgs e) + { + } + + //刷卡成功 + private void MBrushIdCard_IdCardBrushed(object sender, IdCardEventArgs e) + { + var idCard = e.IdCard.ID; + //MessageBox.Show(string.Format("刷卡成功,身份证号:{0}", idCard)); + FillViewEntity(idCard); + Close(); } void ReadCardForm_KeyPress(object sender, KeyPressEventArgs e) { - if (e.KeyChar == (char)Keys.Enter) - { - var arr = _cardNumber.Split(new char[] { (char)Keys.Tab }, StringSplitOptions.RemoveEmptyEntries); - if (arr.Length == 8) - _cardNumber = arr[5]; - else - { - DialogForm.ShowDialog("身份证读卡配置错误,请联系管理员!", 5); - return; - } - FillViewEntity(_cardNumber); - DialogResult = DialogResult.OK; - } - else - _cardNumber += e.KeyChar.ToString(); + //if (e.KeyChar == (char)Keys.Enter) + //{ + // var arr = _cardNumber.Split(new char[] { (char)Keys.Tab }, StringSplitOptions.RemoveEmptyEntries); + // if (arr.Length == 8) + // _cardNumber = arr[5]; + // else + // { + // DialogForm.ShowDialog("身份证读卡配置错误,请联系管理员!", 5); + // return; + // } + // FillViewEntity(_cardNumber); + // DialogResult = DialogResult.OK; + //} + //else + // _cardNumber += e.KeyChar.ToString(); } + + private void FillViewEntity(string idCard) { var list = WeightBillBL.GetViewEntity(idCard).OrderByDescending(x => x.Date).ToList(); @@ -51,10 +66,10 @@ namespace SelfHelpClient this.Close(); } else if (list.Count == 1) - VEntity = list.First(); + Program.ve = list.First(); else { - new ItemSelect(list, this).ShowDialog(); + new ItemSelect(list).ShowDialog(); } } diff --git a/SelfHelpClient/ReadCardForm2.cs b/SelfHelpClient/ReadCardForm2.cs index 19c222d..3f92f26 100644 --- a/SelfHelpClient/ReadCardForm2.cs +++ b/SelfHelpClient/ReadCardForm2.cs @@ -14,24 +14,39 @@ using System.Windows.Forms; namespace SelfHelpClient { public partial class ReadCardForm2 : Form - { - string _cardNumber = ""; + { + string _cardNumber = ""; + BrushIdCard mBrushIdCard; public ViewEntity VEntity { get; set; } public ReadCardForm2() { InitializeComponent(); - this.KeyPress += ReadCardForm_KeyPress; + this.KeyPress += ReadCardForm_KeyPress; + mBrushIdCard = new BrushIdCard(MBrushIdCard_StatusChanged, MBrushIdCard_IdCardBrushed); + } + + private void MBrushIdCard_StatusChanged(object sender, IdCardStatusChangeEventArgs e) + { + } + + //刷卡成功 + private void MBrushIdCard_IdCardBrushed(object sender, IdCardEventArgs e) + { + var idCard = e.IdCard.ID; + //MessageBox.Show(string.Format("刷卡成功,身份证号:{0}", idCard)); + FillViewEntity(idCard); + DialogResult = DialogResult.OK; } void ReadCardForm_KeyPress(object sender, KeyPressEventArgs e) { - if (e.KeyChar == (char)Keys.Tab) - { - FillViewEntity(_cardNumber); - DialogResult = DialogResult.OK; - } - else - _cardNumber += e.KeyChar.ToString(); + //if (e.KeyChar == (char)Keys.Tab) + //{ + // FillViewEntity(_cardNumber); + // DialogResult = DialogResult.OK; + //} + //else + // _cardNumber += e.KeyChar.ToString(); } private void FillViewEntity(string idCard) diff --git a/SelfHelpClient/SelfHelpClient.csproj b/SelfHelpClient/SelfHelpClient.csproj index 5a35d55..5768eff 100644 --- a/SelfHelpClient/SelfHelpClient.csproj +++ b/SelfHelpClient/SelfHelpClient.csproj @@ -1,220 +1,224 @@ - - - - - Debug - AnyCPU - {51EF4E9D-1148-4055-8B1A-9A9DBCA12A03} - WinExe - Properties - SelfHelpClient - SelfHelpClient - v4.5 - 512 - - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - - - - - False - ..\..\..\tsref\Debug\BwpClientPrint.dll - - - False - ..\..\..\tsref\release\Newtonsoft.Json.dll - - - - - - - - - - - - - - - - - - - - - - - - Form - - - DialogForm.cs - - - Form - - - ItemSelect.cs - - - Form - - - ItemSelect2.cs - - - Form - - - MainForm.cs - - - - - True - True - Resources.resx - - - Form - - - ReadCardForm.cs - - - Form - - - ReadCardForm2.cs - - - Form - - - SelfHelpForm.cs - - - Form - - - Template.cs - - - - - - - - Form - - - WeightForm.cs - - - DialogForm.cs - - - ItemSelect.cs - - - ItemSelect2.cs - - - MainForm.cs - - - ResXFileCodeGenerator - Designer - Resources.Designer.cs - - - ReadCardForm.cs - - - ReadCardForm2.cs - - - SelfHelpForm.cs - - - Template.cs - - - WeightForm.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {2485631B-624C-43E0-9287-86FA1C8485FC} - ButcherFactory.Form - - - + + + + + Debug + AnyCPU + {51EF4E9D-1148-4055-8B1A-9A9DBCA12A03} + WinExe + Properties + SelfHelpClient + SelfHelpClient + v4.5 + 512 + + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + + + False + ..\..\..\tsref\Debug\BwpClientPrint.dll + + + False + ..\..\..\tsref\release\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + + + + + Form + + + DialogForm.cs + + + + + + Form + + + ItemSelect.cs + + + Form + + + ItemSelect2.cs + + + Form + + + MainForm.cs + + + + + True + True + Resources.resx + + + Form + + + ReadCardForm.cs + + + Form + + + ReadCardForm2.cs + + + Form + + + SelfHelpForm.cs + + + Form + + + Template.cs + + + + + + + + Form + + + WeightForm.cs + + + DialogForm.cs + + + ItemSelect.cs + + + ItemSelect2.cs + + + MainForm.cs + + + ResXFileCodeGenerator + Designer + Resources.Designer.cs + + + ReadCardForm.cs + + + ReadCardForm2.cs + + + SelfHelpForm.cs + + + Template.cs + + + WeightForm.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {2485631B-624C-43E0-9287-86FA1C8485FC} + ButcherFactory.Form + + + + --> \ No newline at end of file