From f17e9a5dd1670bd401c9b7987c879a7347b201b9 Mon Sep 17 00:00:00 2001 From: luanhui Date: Thu, 18 Jan 2018 16:53:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=80=9A=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E7=A7=B0=E9=87=8D=E6=8E=A7=E4=BB=B6=20=20=E7=88=BD=E6=AD=AA?= =?UTF-8?q?=E6=AD=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- B3ButcherManageClient.sln | 10 +- BWP.WinFormControl/BWP.WinFormControl.csproj | 29 +- ...igner.cs => WeightControlYiBo.Designer.cs} | 2 +- ...{WeightControl.cs => WeightControlYiBo.cs} | 4 +- ...ghtControl.resx => WeightControlYiBo.resx} | 0 .../WeightControl_/WeightConfigs.cs | 124 ++++ .../WeightControl_/WeightControl.Designer.cs | 132 ++++ .../WeightControl_/WeightControl.cs | 341 ++++++++++ .../WeightControl_/WeightControl.resx | 141 ++++ .../WeightControl_/WeightEventArgu.cs | 28 + .../WeightControl_/WeightSetForm.Designer.cs | 277 ++++++++ .../WeightControl_/WeightSetForm.cs | 97 +++ .../WeightControl_/WeightSetForm.resx | 120 ++++ BWP.WinFormControl/XmlUtil.cs | 58 ++ MaterialRequisition/App.config | 6 + .../MaterialRequisition.csproj | 115 ++++ .../MaterialRequisitionForm.Designer.cs | 631 ++++++++++++++++++ .../MaterialRequisitionForm.cs | 238 +++++++ .../MaterialRequisitionForm.resx | 162 +++++ .../Model/MaterialRequisitionRecord.cs | 41 ++ .../Model/MaterialRequisitionRecordDto.cs | 24 + .../Model/MaterialRequisitionRecordRpc.cs | 61 ++ MaterialRequisition/Program.cs | 22 + .../Properties/AssemblyInfo.cs | 36 + .../Properties/Resources.Designer.cs | 71 ++ MaterialRequisition/Properties/Resources.resx | 117 ++++ .../Properties/Settings.Designer.cs | 30 + .../Properties/Settings.settings | 7 + WinFormTest/Form1.Designer.cs | 26 +- WinFormTest/Form1.cs | 11 + 30 files changed, 2951 insertions(+), 10 deletions(-) rename BWP.WinFormControl/{WeightControl.Designer.cs => WeightControlYiBo.Designer.cs} (99%) rename BWP.WinFormControl/{WeightControl.cs => WeightControlYiBo.cs} (98%) rename BWP.WinFormControl/{WeightControl.resx => WeightControlYiBo.resx} (100%) create mode 100644 BWP.WinFormControl/WeightControl_/WeightConfigs.cs create mode 100644 BWP.WinFormControl/WeightControl_/WeightControl.Designer.cs create mode 100644 BWP.WinFormControl/WeightControl_/WeightControl.cs create mode 100644 BWP.WinFormControl/WeightControl_/WeightControl.resx create mode 100644 BWP.WinFormControl/WeightControl_/WeightEventArgu.cs create mode 100644 BWP.WinFormControl/WeightControl_/WeightSetForm.Designer.cs create mode 100644 BWP.WinFormControl/WeightControl_/WeightSetForm.cs create mode 100644 BWP.WinFormControl/WeightControl_/WeightSetForm.resx create mode 100644 BWP.WinFormControl/XmlUtil.cs create mode 100644 MaterialRequisition/App.config create mode 100644 MaterialRequisition/MaterialRequisition.csproj create mode 100644 MaterialRequisition/MaterialRequisitionForm.Designer.cs create mode 100644 MaterialRequisition/MaterialRequisitionForm.cs create mode 100644 MaterialRequisition/MaterialRequisitionForm.resx create mode 100644 MaterialRequisition/Model/MaterialRequisitionRecord.cs create mode 100644 MaterialRequisition/Model/MaterialRequisitionRecordDto.cs create mode 100644 MaterialRequisition/Model/MaterialRequisitionRecordRpc.cs create mode 100644 MaterialRequisition/Program.cs create mode 100644 MaterialRequisition/Properties/AssemblyInfo.cs create mode 100644 MaterialRequisition/Properties/Resources.Designer.cs create mode 100644 MaterialRequisition/Properties/Resources.resx create mode 100644 MaterialRequisition/Properties/Settings.Designer.cs create mode 100644 MaterialRequisition/Properties/Settings.settings diff --git a/B3ButcherManageClient.sln b/B3ButcherManageClient.sln index 0ce7c87..c82c42a 100644 --- a/B3ButcherManageClient.sln +++ b/B3ButcherManageClient.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2020 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BO", "BO\BO.csproj", "{8968F14A-C7C7-4751-96CE-B114FBFD65EF}" EndProject @@ -39,6 +39,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropPigReOrder", "DropPigRe EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormTest", "WinFormTest\WinFormTest.csproj", "{E9831F50-FD30-465C-9BF1-D3C9C415EF5B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaterialRequisition", "MaterialRequisition\MaterialRequisition.csproj", "{756CB09C-D46E-4BFD-8417-4EA531102E4A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -115,6 +117,10 @@ Global {E9831F50-FD30-465C-9BF1-D3C9C415EF5B}.Debug|Any CPU.Build.0 = Debug|Any CPU {E9831F50-FD30-465C-9BF1-D3C9C415EF5B}.Release|Any CPU.ActiveCfg = Release|Any CPU {E9831F50-FD30-465C-9BF1-D3C9C415EF5B}.Release|Any CPU.Build.0 = Release|Any CPU + {756CB09C-D46E-4BFD-8417-4EA531102E4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {756CB09C-D46E-4BFD-8417-4EA531102E4A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {756CB09C-D46E-4BFD-8417-4EA531102E4A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {756CB09C-D46E-4BFD-8417-4EA531102E4A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/BWP.WinFormControl/BWP.WinFormControl.csproj b/BWP.WinFormControl/BWP.WinFormControl.csproj index 677506f..0ccec72 100644 --- a/BWP.WinFormControl/BWP.WinFormControl.csproj +++ b/BWP.WinFormControl/BWP.WinFormControl.csproj @@ -68,6 +68,20 @@ Component + + + UserControl + + + WeightControl.cs + + + + Form + + + WeightSetForm.cs + @@ -92,14 +106,15 @@ VirtualKeyPad.xaml - + UserControl - - WeightControl.cs + + WeightControlYiBo.cs + @@ -120,9 +135,15 @@ UMessageBox.cs - + + WeightControlYiBo.cs + + WeightControl.cs + + WeightSetForm.cs + diff --git a/BWP.WinFormControl/WeightControl.Designer.cs b/BWP.WinFormControl/WeightControlYiBo.Designer.cs similarity index 99% rename from BWP.WinFormControl/WeightControl.Designer.cs rename to BWP.WinFormControl/WeightControlYiBo.Designer.cs index 171bdb0..95338c3 100644 --- a/BWP.WinFormControl/WeightControl.Designer.cs +++ b/BWP.WinFormControl/WeightControlYiBo.Designer.cs @@ -1,7 +1,7 @@ using System.Windows.Forms; namespace BWP.WinFormControl { - partial class WeightControl + partial class WeightControlYiBo { /// /// 必需的设计器变量。 diff --git a/BWP.WinFormControl/WeightControl.cs b/BWP.WinFormControl/WeightControlYiBo.cs similarity index 98% rename from BWP.WinFormControl/WeightControl.cs rename to BWP.WinFormControl/WeightControlYiBo.cs index 061976c..5a97311 100644 --- a/BWP.WinFormControl/WeightControl.cs +++ b/BWP.WinFormControl/WeightControlYiBo.cs @@ -21,7 +21,7 @@ namespace BWP.WinFormControl Xk3190A9, Xk3190D10 } - public partial class WeightControl : UserControl + public partial class WeightControlYiBo : UserControl { public event EventHandler InitWeightInfo; @@ -85,7 +85,7 @@ namespace BWP.WinFormControl public CheckBox EnableCheckBox { get { return enableWeightBox; } } - public WeightControl() + public WeightControlYiBo() { InitializeComponent(); Control.CheckForIllegalCrossThreadCalls = false; diff --git a/BWP.WinFormControl/WeightControl.resx b/BWP.WinFormControl/WeightControlYiBo.resx similarity index 100% rename from BWP.WinFormControl/WeightControl.resx rename to BWP.WinFormControl/WeightControlYiBo.resx diff --git a/BWP.WinFormControl/WeightControl_/WeightConfigs.cs b/BWP.WinFormControl/WeightControl_/WeightConfigs.cs new file mode 100644 index 0000000..3c18b1c --- /dev/null +++ b/BWP.WinFormControl/WeightControl_/WeightConfigs.cs @@ -0,0 +1,124 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace BWP.WinFormControl.WeightControl_ +{ + public class WeightContext + { + private static string loginConfigPath = Application.StartupPath + "\\WeightConfigs.xml"; + + private static WeightConfigs _configs; + public static WeightConfig GetConfig(ApplyTo applyto) + { + var config = Configs.Configs.Find(x => x.ApplyTo == applyto); + if (config == null) + { + config=new WeightConfig(); + config.ApplyTo = applyto; + Configs.Configs.Add(config); + XmlUtil.SerializerObjToFile(Configs, loginConfigPath); + } + return config; + } + + public static WeightConfigs Configs + { + get + { + if (_configs == null) + _configs = CreateConfigs(); + return _configs; + } + } + + static WeightConfigs CreateConfigs( ) + { + var configs = new WeightConfigs(); + if (!File.Exists(loginConfigPath)) + { + XmlUtil.SerializerObjToFile(configs, loginConfigPath); + } + else + { + configs = XmlUtil.DeserializeFromFile(loginConfigPath); + } + return configs; + } + + public static void Save(ApplyTo applyto) + { + var config = Configs.Configs.First(x=>x.ApplyTo== applyto); + if (string.IsNullOrEmpty(config.WeightSet)) + throw new Exception("请选择称型号"); + if (string.IsNullOrEmpty(config.ComSet)) + throw new Exception("请选择Com口"); + if (config.RateSet == null) + throw new Exception("请选择波特率"); + if (config.BitSet == null) + throw new Exception("请选择数据位"); + if (string.IsNullOrEmpty(config.Format)) + throw new Exception("请填写显示格式"); + try + { + string.Format("{0:" + config.Format + "}", 1); + } + catch (Exception ex) + { + throw new Exception("显示格式填写错误\n" + ex.Message); + } + + XmlUtil.SerializerObjToFile(Configs, loginConfigPath); + } + + } + + public class WeightConfigs + { + public WeightConfigs() + { + Configs=new List(); + } + + public List Configs { get; set; } + } + + public class WeightConfig + { + public ApplyTo ApplyTo { get; set; } + + public string WeightSet { get; set; } + + public string ComSet { get; set; } + + public int? RateSet { get; set; } + + private int mBitSet = 8; + public int BitSet + { + get { return mBitSet;} + set { mBitSet = value; } + } + + public string Format { get; set; } + + public decimal? Discont { get; set; } + + public int WeightType { get; set; } + + public decimal MinWeight { get; set; } + + public decimal MaxWeight { get; set; } + } + + public enum ApplyTo + { + 胴体入库=1, + 分割称重 = 2, + 领料退料=3 +} +} diff --git a/BWP.WinFormControl/WeightControl_/WeightControl.Designer.cs b/BWP.WinFormControl/WeightControl_/WeightControl.Designer.cs new file mode 100644 index 0000000..6986af6 --- /dev/null +++ b/BWP.WinFormControl/WeightControl_/WeightControl.Designer.cs @@ -0,0 +1,132 @@ +namespace BWP.WinFormControl.WeightControl_ +{ + partial class WeightControl + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.btnStartWeight = new System.Windows.Forms.Button(); + this.panel2 = new System.Windows.Forms.Panel(); + this.lblChengZhong = new System.Windows.Forms.Label(); + this.btnWeightSet = new System.Windows.Forms.Button(); + this.btnEndWeight = new System.Windows.Forms.Button(); + this.picNetStatus = new System.Windows.Forms.PictureBox(); + this.panel2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.picNetStatus)).BeginInit(); + this.SuspendLayout(); + // + // btnStartWeight + // + this.btnStartWeight.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnStartWeight.Location = new System.Drawing.Point(0, 98); + this.btnStartWeight.Name = "btnStartWeight"; + this.btnStartWeight.Size = new System.Drawing.Size(95, 43); + this.btnStartWeight.TabIndex = 44; + this.btnStartWeight.Text = "开始称重"; + this.btnStartWeight.UseVisualStyleBackColor = true; + this.btnStartWeight.Click += new System.EventHandler(this.btnStartWeight_Click); + // + // panel2 + // + this.panel2.BackColor = System.Drawing.Color.Black; + this.panel2.Controls.Add(this.lblChengZhong); + this.panel2.Location = new System.Drawing.Point(3, 3); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(224, 89); + this.panel2.TabIndex = 43; + // + // lblChengZhong + // + this.lblChengZhong.AutoSize = true; + this.lblChengZhong.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblChengZhong.ForeColor = System.Drawing.Color.Red; + this.lblChengZhong.Location = new System.Drawing.Point(15, 18); + this.lblChengZhong.Name = "lblChengZhong"; + this.lblChengZhong.Size = new System.Drawing.Size(97, 40); + this.lblChengZhong.TabIndex = 0; + this.lblChengZhong.Text = "0.00"; + // + // btnWeightSet + // + this.btnWeightSet.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnWeightSet.Location = new System.Drawing.Point(233, 3); + this.btnWeightSet.Name = "btnWeightSet"; + this.btnWeightSet.Size = new System.Drawing.Size(65, 41); + this.btnWeightSet.TabIndex = 42; + this.btnWeightSet.Text = "称设置"; + this.btnWeightSet.UseVisualStyleBackColor = true; + this.btnWeightSet.Click += new System.EventHandler(this.btnWeightSet_Click); + // + // btnEndWeight + // + this.btnEndWeight.Enabled = false; + this.btnEndWeight.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnEndWeight.Location = new System.Drawing.Point(130, 98); + this.btnEndWeight.Name = "btnEndWeight"; + this.btnEndWeight.Size = new System.Drawing.Size(97, 43); + this.btnEndWeight.TabIndex = 44; + this.btnEndWeight.Text = "停止称重"; + this.btnEndWeight.UseVisualStyleBackColor = true; + this.btnEndWeight.Click += new System.EventHandler(this.btnEndWeight_Click); + // + // picNetStatus + // + this.picNetStatus.ErrorImage = null; + this.picNetStatus.InitialImage = null; + this.picNetStatus.Location = new System.Drawing.Point(249, 62); + this.picNetStatus.Name = "picNetStatus"; + this.picNetStatus.Size = new System.Drawing.Size(30, 30); + this.picNetStatus.TabIndex = 45; + this.picNetStatus.TabStop = false; + // + // WeightControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.picNetStatus); + this.Controls.Add(this.btnEndWeight); + this.Controls.Add(this.btnStartWeight); + this.Controls.Add(this.panel2); + this.Controls.Add(this.btnWeightSet); + this.Name = "WeightControl"; + this.Size = new System.Drawing.Size(303, 143); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.picNetStatus)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button btnStartWeight; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Label lblChengZhong; + private System.Windows.Forms.Button btnWeightSet; + private System.Windows.Forms.Button btnEndWeight; + private System.Windows.Forms.PictureBox picNetStatus; + } +} diff --git a/BWP.WinFormControl/WeightControl_/WeightControl.cs b/BWP.WinFormControl/WeightControl_/WeightControl.cs new file mode 100644 index 0000000..64cb12e --- /dev/null +++ b/BWP.WinFormControl/WeightControl_/WeightControl.cs @@ -0,0 +1,341 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.IO; +using System.IO.Ports; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using BWP.WinFormControl.WeightDataFormat; + +namespace BWP.WinFormControl.WeightControl_ +{ + public partial class WeightControl : UserControl + { + public ApplyTo ApplyTo { get; set; } + + //定义委托 + public delegate void WeightHandle(object sender, WeightEventArgu e); + //定义事件 + public event WeightHandle WeightEventHandle; + + public WeightControl() + { + InitializeComponent(); + weightPort = new SerialPort(); + + _checkComStatusThread = new Thread(SetComStatus); + _checkComStatusThread.Start(); + } + + public void Close() + { + if (_inQueryThread != null && _inQueryThread.IsAlive) + { + DisableWeight(); + } + if (_checkComStatusThread != null && _checkComStatusThread.IsAlive) + { + Thread.Sleep(10); + if (_checkComStatusThread.IsAlive) + { + _checkComStatusThread.Abort(); + } + } + } + + public WeightConfig WeightConfig + { + get { return WeightContext.GetConfig(ApplyTo); } + } + + #region weightNeed + SerialPort weightPort; + private IDataFormat _dataFormat; + private Thread _inQueryThread; + private Thread _checkComStatusThread; + private bool _mainProcessIsRun; + readonly StringBuilder _dataStrBuilder = new StringBuilder(); + + readonly StringBuilder _allDataStrBuilder = new StringBuilder(); + #endregion + + #region weightNeed + void OpenSerialPort() + { + if (WeightConfig.RateSet == null) + { + throw new Exception("请先配置称相关信息"); + } + + weightPort.PortName = WeightConfig.ComSet; + weightPort.BaudRate = WeightConfig.RateSet.Value; + weightPort.DataBits = WeightConfig.BitSet; + weightPort.ReadBufferSize = 4096 * 100; + if (!string.IsNullOrEmpty(WeightConfig.Format)) + { + format = "{0:{format}}".Replace("{format}", WeightConfig.Format); + } + switch (WeightConfig.WeightSet) + { + case "IND560": + _dataFormat = new IND560DataFormat(); + break; + case "Xk3124": + case "IND231": + _dataFormat = new Xk3124DataFormat(); + break; + case "Xk3190A9": + _dataFormat = new Xk3190A9DataFormat(); + break; + default: + _dataFormat = new Xk3190D10DataFormat(); + break; + } + if (!weightPort.IsOpen) + { + try + { + weightPort.Open(); + } + catch (InvalidOperationException) + { + MessageBox.Show(@"指定的端口已打开"); + } + catch (UnauthorizedAccessException) + { + MessageBox.Show(@"对端口的访问被拒绝"); + } + } + } + + void ReadData() + { + _inQueryThread = new Thread(InQuery); + _inQueryThread.Start(); + } + + string format = "{0:0.00}"; + + private void InQuery() + { + + while (_mainProcessIsRun) + { + int availableCount = weightPort.BytesToRead; + if (availableCount == 0) + { + Thread.Sleep(1); + } + + char[] buffer = new char[availableCount]; + if (!weightPort.IsOpen) + { + continue; + } + weightPort.Read(buffer, 0, availableCount); + foreach (var c in buffer) + { + _allDataStrBuilder.Append(c); + if (c == _dataFormat.Beginchar) + { + _dataStrBuilder.Clear(); + _dataStrBuilder.Append(c); + } + else if (c == _dataFormat.Endchar && _dataStrBuilder.Length == _dataFormat.DataLength - 1) + { + _dataStrBuilder.Append(c); + bool isStatic; + string str; + if (_dataFormat.ParseAscii(_dataStrBuilder.ToString(), out str, out isStatic)) + { + if (WeightConfig.WeightType == 0) + { + if (string.IsNullOrEmpty(str)) + str = "0"; + this.Invoke(new Action(delegate () + { + lblChengZhong.Text = string.Format(format, decimal.Parse(str)); + if (str != "0") + { + if (WeightEventHandle != null) + { + var argu = new WeightEventArgu(lblChengZhong.Text, format); + WeightEventHandle(lblChengZhong, argu); + } + } + })); + } + else + { + decimal num = 0; + if (decimal.TryParse(str, out num)) + { + this.Invoke(new Action(delegate () + { + lblChengZhong.Text = string.Format(format, num); + })); + WeighAvgControl.Add(WeightConfig, num, isStatic); + } + if (WeighAvgControl.TryGetValue(out num)) + { + this.Invoke(new Action(delegate () + { + lblChengZhong.Text = string.Format(format, num); + if (str != "0") + { + if (WeightEventHandle != null) + { + var argu = new WeightEventArgu(lblChengZhong.Text, format); + WeightEventHandle(lblChengZhong, argu); + } + } + })); + } + } + } + _dataStrBuilder.Clear(); + } + else if (_dataStrBuilder.Length != 0) + { + _dataStrBuilder.Append(c); + } + } + } + } + + private class WeighAvgControl + { + public static bool TryGetValue(out decimal result) + { + List> list; + if (mWeighList.TryDequeue(out list)) + { + var r = list.Where(x => x.Item2).Select(x => x.Item1).GroupBy(x => x); + var firstOrDefault = r.OrderByDescending(x => x.Count()).FirstOrDefault(); + if (firstOrDefault != null) + { + result = firstOrDefault.Key; + return true; + } + result = 0; + return false; + } + result = 0; + return false; + } + + static ConcurrentQueue>> mWeighList = new ConcurrentQueue>>(); + + static List> _list = new List>(); + + public static void Add(WeightConfig weightConfig, decimal value, bool isStatic) + { + if (value >= weightConfig.MinWeight && value <= weightConfig.MaxWeight) + { + _list.Add(new Tuple(value, isStatic)); + } + else + { + if (_list.Count > 0) + { + mWeighList.Enqueue(_list); + _list = new List>(); + } + } + } + } + + void DisableWeight() + { + _mainProcessIsRun = false; + lblChengZhong.Text = string.Format(format, 0); + format = "{0:0.00}"; + if (WeightEventHandle != null) + { + var argu = new WeightEventArgu(lblChengZhong.Text, format); + WeightEventHandle(lblChengZhong, argu); + } + Thread.Sleep(10); + if (_inQueryThread.IsAlive) + { + _inQueryThread.Abort(); + } + if (weightPort.IsOpen) + weightPort.Close(); + } + #endregion + + + private void SetComStatus() + { + while (true) + { + try + { + var png = "stop.png"; + + if (_allDataStrBuilder.Length > 0) + { + png = "working.png"; + _allDataStrBuilder.Clear(); + } + var imgPath = Path.Combine(Application.StartupPath, "BWP.WinFormControl.dll"); + var s = Assembly.LoadFile(imgPath).GetManifestResourceStream("BWP.WinFormControl.Images." + png); + if (this.InvokeRequired) + { + this.BeginInvoke(new Action(() => + { + picNetStatus.Image = Image.FromStream(s); + picNetStatus.Refresh(); + })); + } + else + { + picNetStatus.Image = Image.FromStream(s); + picNetStatus.Refresh(); + } + } + catch (Exception e) + { + //LogUtil.Error(e.ToString()); + } + + Thread.Sleep(500); + } + } + + + private void btnWeightSet_Click(object sender, EventArgs e) + { + var f = new WeightSetForm(ApplyTo); + if (f.ShowDialog() == DialogResult.OK) + { + + } + + } + + private void btnStartWeight_Click(object sender, EventArgs e) + { + _mainProcessIsRun = true; + OpenSerialPort(); + ReadData(); + btnStartWeight.Enabled = false; + btnEndWeight.Enabled = true; + } + + private void btnEndWeight_Click(object sender, EventArgs e) + { + DisableWeight(); + btnStartWeight.Enabled = true; + btnEndWeight.Enabled = false; + } + } +} diff --git a/BWP.WinFormControl/WeightControl_/WeightControl.resx b/BWP.WinFormControl/WeightControl_/WeightControl.resx new file mode 100644 index 0000000..22531c8 --- /dev/null +++ b/BWP.WinFormControl/WeightControl_/WeightControl.resx @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/BWP.WinFormControl/WeightControl_/WeightEventArgu.cs b/BWP.WinFormControl/WeightControl_/WeightEventArgu.cs new file mode 100644 index 0000000..1e13b76 --- /dev/null +++ b/BWP.WinFormControl/WeightControl_/WeightEventArgu.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BWP.WinFormControl.WeightControl_ +{ + public class WeightEventArgu : EventArgs + { + private string mWeight; + private string mFormat; + + public WeightEventArgu(string weight,string format) + { + mWeight = weight; + mFormat = format; + } + + public string WeightData + { + get + { + return string.Format(mFormat, decimal.Parse(mWeight)); + } + } + } +} diff --git a/BWP.WinFormControl/WeightControl_/WeightSetForm.Designer.cs b/BWP.WinFormControl/WeightControl_/WeightSetForm.Designer.cs new file mode 100644 index 0000000..6dab325 --- /dev/null +++ b/BWP.WinFormControl/WeightControl_/WeightSetForm.Designer.cs @@ -0,0 +1,277 @@ +namespace BWP.WinFormControl.WeightControl_ +{ + partial class WeightSetForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.maxInput = new BWP.WinFormControl.UTextBoxWithPad(); + this.minInput = new BWP.WinFormControl.UTextBoxWithPad(); + this.label8 = new System.Windows.Forms.Label(); + this.weightReadType = new System.Windows.Forms.ComboBox(); + this.label7 = new System.Windows.Forms.Label(); + this.discont = new BWP.WinFormControl.UTextBoxWithPad(); + this.format = new BWP.WinFormControl.UTextBoxWithPad(); + this.label6 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.saveBtn = new System.Windows.Forms.Button(); + this.bitSet = new System.Windows.Forms.ComboBox(); + this.rateSet = new System.Windows.Forms.ComboBox(); + this.comSet = new System.Windows.Forms.ComboBox(); + this.weightSet = new System.Windows.Forms.ComboBox(); + this.label4 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // maxInput + // + this.maxInput.Font = new System.Drawing.Font("宋体", 12F); + this.maxInput.Location = new System.Drawing.Point(258, 365); + this.maxInput.Name = "maxInput"; + this.maxInput.Size = new System.Drawing.Size(55, 26); + this.maxInput.TabIndex = 86; + this.maxInput.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Number; + // + // minInput + // + this.minInput.Font = new System.Drawing.Font("宋体", 12F); + this.minInput.Location = new System.Drawing.Point(192, 365); + this.minInput.Name = "minInput"; + this.minInput.Size = new System.Drawing.Size(55, 26); + this.minInput.TabIndex = 85; + this.minInput.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Number; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("宋体", 15F); + this.label8.Location = new System.Drawing.Point(70, 365); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(109, 20); + this.label8.TabIndex = 84; + this.label8.Text = "有效区间:"; + // + // weightReadType + // + this.weightReadType.Font = new System.Drawing.Font("宋体", 15F); + this.weightReadType.FormattingEnabled = true; + this.weightReadType.Location = new System.Drawing.Point(192, 318); + this.weightReadType.Name = "weightReadType"; + this.weightReadType.Size = new System.Drawing.Size(121, 28); + this.weightReadType.TabIndex = 83; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("宋体", 15F); + this.label7.Location = new System.Drawing.Point(70, 321); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(109, 20); + this.label7.TabIndex = 82; + this.label7.Text = "读取方式:"; + // + // discont + // + this.discont.Font = new System.Drawing.Font("宋体", 14F); + this.discont.Location = new System.Drawing.Point(192, 269); + this.discont.Name = "discont"; + this.discont.Size = new System.Drawing.Size(121, 29); + this.discont.TabIndex = 81; + this.discont.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Number; + // + // format + // + this.format.Font = new System.Drawing.Font("宋体", 14F); + this.format.Location = new System.Drawing.Point(192, 221); + this.format.Name = "format"; + this.format.Size = new System.Drawing.Size(121, 29); + this.format.TabIndex = 80; + this.format.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Number; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("宋体", 15F); + this.label6.Location = new System.Drawing.Point(70, 278); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(69, 20); + this.label6.TabIndex = 79; + this.label6.Text = "扣重:"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("宋体", 15F); + this.label5.Location = new System.Drawing.Point(70, 227); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(109, 20); + this.label5.TabIndex = 78; + this.label5.Text = "显示格式:"; + // + // saveBtn + // + this.saveBtn.Font = new System.Drawing.Font("宋体", 15F); + this.saveBtn.Location = new System.Drawing.Point(151, 413); + this.saveBtn.Name = "saveBtn"; + this.saveBtn.Size = new System.Drawing.Size(96, 52); + this.saveBtn.TabIndex = 76; + this.saveBtn.Text = "保存"; + this.saveBtn.UseVisualStyleBackColor = true; + this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click); + // + // bitSet + // + this.bitSet.Font = new System.Drawing.Font("宋体", 15F); + this.bitSet.FormattingEnabled = true; + this.bitSet.Location = new System.Drawing.Point(192, 174); + this.bitSet.Name = "bitSet"; + this.bitSet.Size = new System.Drawing.Size(121, 28); + this.bitSet.TabIndex = 73; + // + // rateSet + // + this.rateSet.Font = new System.Drawing.Font("宋体", 15F); + this.rateSet.FormattingEnabled = true; + this.rateSet.Location = new System.Drawing.Point(192, 122); + this.rateSet.Name = "rateSet"; + this.rateSet.Size = new System.Drawing.Size(121, 28); + this.rateSet.TabIndex = 74; + // + // comSet + // + this.comSet.Font = new System.Drawing.Font("宋体", 15F); + this.comSet.FormattingEnabled = true; + this.comSet.Location = new System.Drawing.Point(192, 72); + this.comSet.Name = "comSet"; + this.comSet.Size = new System.Drawing.Size(121, 28); + this.comSet.TabIndex = 75; + // + // weightSet + // + this.weightSet.Font = new System.Drawing.Font("宋体", 15F); + this.weightSet.FormattingEnabled = true; + this.weightSet.Location = new System.Drawing.Point(192, 24); + this.weightSet.Name = "weightSet"; + this.weightSet.Size = new System.Drawing.Size(121, 28); + this.weightSet.TabIndex = 72; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("宋体", 15F); + this.label4.Location = new System.Drawing.Point(70, 177); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(89, 20); + this.label4.TabIndex = 71; + this.label4.Text = "数据位:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("宋体", 15F); + this.label3.Location = new System.Drawing.Point(70, 125); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(89, 20); + this.label3.TabIndex = 70; + this.label3.Text = "波特率:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("宋体", 15F); + this.label2.Location = new System.Drawing.Point(70, 75); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(89, 20); + this.label2.TabIndex = 69; + this.label2.Text = "端口号:"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 15F); + this.label1.Location = new System.Drawing.Point(70, 27); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(89, 20); + this.label1.TabIndex = 68; + this.label1.Text = "称型号:"; + // + // WeightSetForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(406, 492); + this.Controls.Add(this.maxInput); + this.Controls.Add(this.minInput); + this.Controls.Add(this.label8); + this.Controls.Add(this.weightReadType); + this.Controls.Add(this.label7); + this.Controls.Add(this.discont); + this.Controls.Add(this.format); + this.Controls.Add(this.label6); + this.Controls.Add(this.label5); + this.Controls.Add(this.saveBtn); + this.Controls.Add(this.bitSet); + this.Controls.Add(this.rateSet); + this.Controls.Add(this.comSet); + this.Controls.Add(this.weightSet); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "WeightSetForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "称设置"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private UTextBoxWithPad maxInput; + private UTextBoxWithPad minInput; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.ComboBox weightReadType; + private System.Windows.Forms.Label label7; + private UTextBoxWithPad discont; + private UTextBoxWithPad format; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Button saveBtn; + private System.Windows.Forms.ComboBox bitSet; + private System.Windows.Forms.ComboBox rateSet; + private System.Windows.Forms.ComboBox comSet; + private System.Windows.Forms.ComboBox weightSet; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + } +} \ No newline at end of file diff --git a/BWP.WinFormControl/WeightControl_/WeightSetForm.cs b/BWP.WinFormControl/WeightControl_/WeightSetForm.cs new file mode 100644 index 0000000..7456aba --- /dev/null +++ b/BWP.WinFormControl/WeightControl_/WeightSetForm.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace BWP.WinFormControl.WeightControl_ +{ + public partial class WeightSetForm : Form + { + List weight = new List { "IND560", "Xk3124", "Xk3190A9", "Xk3190D10", "IND231" }; + List com = new List { "COM1", "COM2", "COM3", "COM4", "COM5" }; + List rate = new List { "1200", "2400", "4800", "7200", "9600" }; + List bit = new List { "5", "6", "7", "8" }; + List weightRead = new List { "稳定读取", "连续发送" }; + + private ApplyTo mApplyTo; + public WeightSetForm(ApplyTo applyTo) + { + mApplyTo = applyTo; + InitializeComponent(); + weightSet.DataSource = weight; + comSet.DataSource = com; + rateSet.DataSource = rate; + bitSet.DataSource = bit; + weightReadType.DataSource = weightRead; + if (!string.IsNullOrEmpty(WeightContext.GetConfig(applyTo).WeightSet)) + weightSet.SelectedIndex = weight.IndexOf(WeightContext.GetConfig(applyTo).WeightSet); + else + weightSet.SelectedIndex = 0; + if (!string.IsNullOrEmpty(WeightContext.GetConfig(applyTo).ComSet)) + comSet.SelectedIndex = com.IndexOf(WeightContext.GetConfig(applyTo).ComSet); + else + comSet.SelectedIndex = 0; + if (WeightContext.GetConfig(applyTo).RateSet.HasValue) + rateSet.SelectedIndex = rate.IndexOf(WeightContext.GetConfig(applyTo).RateSet.ToString()); + else + rateSet.SelectedIndex = 2; + if (WeightContext.GetConfig(applyTo).BitSet!=0) + bitSet.SelectedIndex = bit.IndexOf(WeightContext.GetConfig(applyTo).BitSet.ToString()); + else + bitSet.SelectedIndex = 3; + if (string.IsNullOrEmpty(WeightContext.GetConfig(applyTo).Format)) + format.Text = "0.00"; + else + format.Text = WeightContext.GetConfig(applyTo).Format; + if (WeightContext.GetConfig(applyTo).Discont == null) + discont.Text = "0.00"; + else + discont.Text = WeightContext.GetConfig(applyTo).Discont.ToString(); + weightReadType.SelectedIndex = WeightContext.GetConfig(applyTo).WeightType; + minInput.Text = WeightContext.GetConfig(applyTo).MinWeight.ToString(); + maxInput.Text = WeightContext.GetConfig(applyTo).MaxWeight.ToString(); + } + + private void saveBtn_Click(object sender, EventArgs e) + { + WeightContext.GetConfig(mApplyTo).WeightSet = weight[this.weightSet.SelectedIndex]; + WeightContext.GetConfig(mApplyTo).ComSet = com[this.comSet.SelectedIndex]; + WeightContext.GetConfig(mApplyTo).RateSet = int.Parse(rate[this.rateSet.SelectedIndex]); + WeightContext.GetConfig(mApplyTo).BitSet = int.Parse(bit[this.bitSet.SelectedIndex]); + WeightContext.GetConfig(mApplyTo).Format = format.Text; + WeightContext.GetConfig(mApplyTo).WeightType = weightReadType.SelectedIndex; + if (WeightContext.GetConfig(mApplyTo).WeightType == 1) + { + decimal min = 0; + decimal max = 0; + if (!decimal.TryParse(minInput.Text.Trim(), out min)) + throw new Exception("连续发送时 必须输入有效区间"); + if (!decimal.TryParse(maxInput.Text.Trim(), out max)) + throw new Exception("连续发送时 必须输入有效区间"); + WeightContext.GetConfig(mApplyTo).MinWeight = min; + WeightContext.GetConfig(mApplyTo).MaxWeight = max; + } + if (!string.IsNullOrEmpty(discont.Text)) + { + decimal v; + if (decimal.TryParse(discont.Text, out v)) + WeightContext.GetConfig(mApplyTo).Discont = v; + else + throw new Exception("扣重格式输入不正确"); + } + else + { + WeightContext.GetConfig(mApplyTo).Discont = 0; + } + WeightContext.Save(mApplyTo); + MessageBox.Show("保存成功!"); + DialogResult = DialogResult.OK; + Close(); + } + } +} diff --git a/BWP.WinFormControl/WeightControl_/WeightSetForm.resx b/BWP.WinFormControl/WeightControl_/WeightSetForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/BWP.WinFormControl/WeightControl_/WeightSetForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/BWP.WinFormControl/XmlUtil.cs b/BWP.WinFormControl/XmlUtil.cs new file mode 100644 index 0000000..b8417b8 --- /dev/null +++ b/BWP.WinFormControl/XmlUtil.cs @@ -0,0 +1,58 @@ +using System.IO; +using System.Text; +using System.Xml.Serialization; + +namespace BWP.WinFormControl +{ + internal class XmlUtil + { + public static void SerializerObjToFile(object obj, string fileName = "") + { + if (string.IsNullOrWhiteSpace(fileName)) + { + fileName = obj.GetType().Name + ".xml"; + } + + var ser = new XmlSerializer(obj.GetType()); + using (var stream = File.Open(fileName, FileMode.Create)) + { + ser.Serialize(stream, obj); + } + } + + public static T DeserializeFromFile(string fileName = "") + where T : new() + { + if (string.IsNullOrWhiteSpace(fileName)) + { + fileName = typeof(T).Name + ".xml"; + } + if (!File.Exists(fileName)) + { + return new T(); + } + using (var reader = new StreamReader(fileName)) + { + var xs = new XmlSerializer(typeof(T)); + object obj = xs.Deserialize(reader); + reader.Close(); + return (T)obj; + } + } + + public static T XmlDeserializeObject(string xmlOfObject) where T : class + { + using (MemoryStream ms = new MemoryStream()) + { + using (StreamWriter sr = new StreamWriter(ms, Encoding.UTF8)) + { + sr.Write(xmlOfObject); + sr.Flush(); + ms.Seek(0, SeekOrigin.Begin); + XmlSerializer serializer = new XmlSerializer(typeof(T)); + return serializer.Deserialize(ms) as T; + } + } + } + } +} diff --git a/MaterialRequisition/App.config b/MaterialRequisition/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/MaterialRequisition/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MaterialRequisition/MaterialRequisition.csproj b/MaterialRequisition/MaterialRequisition.csproj new file mode 100644 index 0000000..315cb08 --- /dev/null +++ b/MaterialRequisition/MaterialRequisition.csproj @@ -0,0 +1,115 @@ + + + + + Debug + AnyCPU + {756CB09C-D46E-4BFD-8417-4EA531102E4A} + WinExe + MaterialRequisition + MaterialRequisition + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\ButcherManageClient\bin\Debug\AutoMapper.dll + + + False + ..\..\..\tsref\Debug\Forks.EnterpriseServices.dll + + + + False + ..\..\..\tsref\Debug\Forks.Utils.dll + + + False + ..\..\..\tsref\Debug\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + Form + + + MaterialRequisitionForm.cs + + + + + + + + MaterialRequisitionForm.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + {8968f14a-c7c7-4751-96ce-b114fbfd65ef} + BO + + + {A782B23E-BE6D-4F51-B5CB-5CD259BA97CC} + BWP.WinFormControl + + + + + \ No newline at end of file diff --git a/MaterialRequisition/MaterialRequisitionForm.Designer.cs b/MaterialRequisition/MaterialRequisitionForm.Designer.cs new file mode 100644 index 0000000..046da38 --- /dev/null +++ b/MaterialRequisition/MaterialRequisitionForm.Designer.cs @@ -0,0 +1,631 @@ +namespace MaterialRequisition +{ + partial class MaterialRequisitionForm + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows 窗体设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.dataGridViewUnSubmit = new BWP.WinFormControl.UDataGridView(); + this.btnCommit = new System.Windows.Forms.Button(); + this.btnDelete = new System.Windows.Forms.Button(); + this.panel1 = new System.Windows.Forms.Panel(); + this.btnEnableWeight = new System.Windows.Forms.Button(); + this.picSyncStatus = new System.Windows.Forms.PictureBox(); + this.picNetStatus = new System.Windows.Forms.PictureBox(); + this.label11 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.panel3 = new System.Windows.Forms.Panel(); + this.cbxWorkUnit = new System.Windows.Forms.ComboBox(); + this.label5 = new System.Windows.Forms.Label(); + this.cbxWorkShop = new System.Windows.Forms.ComboBox(); + this.label4 = new System.Windows.Forms.Label(); + this.panel2 = new System.Windows.Forms.Panel(); + this.lblChengZhong = new System.Windows.Forms.Label(); + this.btnWeightSet = new System.Windows.Forms.Button(); + this.dataGridViewSubmited = new BWP.WinFormControl.UDataGridView(); + this.un序号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.un条码 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.un编码 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.un名称 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.un重量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.un单位 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.un数量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.panel4 = new System.Windows.Forms.Panel(); + this.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.textBox3 = new System.Windows.Forms.TextBox(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridViewUnSubmit)).BeginInit(); + this.panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.picSyncStatus)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picNetStatus)).BeginInit(); + this.panel3.SuspendLayout(); + this.panel2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridViewSubmited)).BeginInit(); + this.panel4.SuspendLayout(); + this.SuspendLayout(); + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.groupBox2); + this.splitContainer1.Panel1.Controls.Add(this.groupBox1); + this.splitContainer1.Panel1.Controls.Add(this.panel1); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.panel4); + this.splitContainer1.Size = new System.Drawing.Size(1131, 625); + this.splitContainer1.SplitterDistance = 782; + this.splitContainer1.TabIndex = 0; + // + // groupBox2 + // + this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox2.Controls.Add(this.dataGridViewSubmited); + this.groupBox2.Location = new System.Drawing.Point(12, 415); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(767, 198); + this.groupBox2.TabIndex = 4; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "历史领料"; + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.dataGridViewUnSubmit); + this.groupBox1.Controls.Add(this.btnCommit); + this.groupBox1.Controls.Add(this.btnDelete); + this.groupBox1.Location = new System.Drawing.Point(12, 149); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(767, 258); + this.groupBox1.TabIndex = 4; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "领料明细"; + // + // dataGridViewUnSubmit + // + this.dataGridViewUnSubmit.AllowUserToAddRows = false; + this.dataGridViewUnSubmit.AllowUserToDeleteRows = false; + this.dataGridViewUnSubmit.AllowUserToResizeColumns = false; + this.dataGridViewUnSubmit.AllowUserToResizeRows = false; + dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.dataGridViewUnSubmit.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4; + this.dataGridViewUnSubmit.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridViewUnSubmit.BackgroundColor = System.Drawing.Color.White; + dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridViewUnSubmit.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5; + this.dataGridViewUnSubmit.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridViewUnSubmit.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.un序号, + this.un条码, + this.un编码, + this.un名称, + this.un重量, + this.un单位, + this.un数量}); + this.dataGridViewUnSubmit.Location = new System.Drawing.Point(6, 63); + this.dataGridViewUnSubmit.MultiSelect = false; + this.dataGridViewUnSubmit.Name = "dataGridViewUnSubmit"; + this.dataGridViewUnSubmit.ReadOnly = true; + this.dataGridViewUnSubmit.RowHeadersVisible = false; + dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.dataGridViewUnSubmit.RowsDefaultCellStyle = dataGridViewCellStyle6; + this.dataGridViewUnSubmit.RowTemplate.Height = 23; + this.dataGridViewUnSubmit.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dataGridViewUnSubmit.Size = new System.Drawing.Size(761, 189); + this.dataGridViewUnSubmit.TabIndex = 1; + // + // btnCommit + // + this.btnCommit.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnCommit.Location = new System.Drawing.Point(6, 21); + this.btnCommit.Name = "btnCommit"; + this.btnCommit.Size = new System.Drawing.Size(75, 35); + this.btnCommit.TabIndex = 0; + this.btnCommit.Text = "提交"; + this.btnCommit.UseVisualStyleBackColor = true; + // + // btnDelete + // + this.btnDelete.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnDelete.Location = new System.Drawing.Point(124, 21); + this.btnDelete.Name = "btnDelete"; + this.btnDelete.Size = new System.Drawing.Size(75, 35); + this.btnDelete.TabIndex = 0; + this.btnDelete.Text = "删除"; + this.btnDelete.UseVisualStyleBackColor = true; + // + // panel1 + // + this.panel1.Controls.Add(this.btnEnableWeight); + this.panel1.Controls.Add(this.picSyncStatus); + this.panel1.Controls.Add(this.picNetStatus); + this.panel1.Controls.Add(this.label11); + this.panel1.Controls.Add(this.label10); + this.panel1.Controls.Add(this.panel3); + this.panel1.Controls.Add(this.panel2); + this.panel1.Controls.Add(this.btnWeightSet); + this.panel1.Location = new System.Drawing.Point(8, 8); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(763, 123); + this.panel1.TabIndex = 3; + // + // btnEnableWeight + // + this.btnEnableWeight.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnEnableWeight.Location = new System.Drawing.Point(247, 16); + this.btnEnableWeight.Name = "btnEnableWeight"; + this.btnEnableWeight.Size = new System.Drawing.Size(111, 34); + this.btnEnableWeight.TabIndex = 41; + this.btnEnableWeight.Text = "启用称重"; + this.btnEnableWeight.UseVisualStyleBackColor = true; + // + // picSyncStatus + // + this.picSyncStatus.ErrorImage = null; + this.picSyncStatus.InitialImage = null; + this.picSyncStatus.Location = new System.Drawing.Point(415, 65); + this.picSyncStatus.Name = "picSyncStatus"; + this.picSyncStatus.Size = new System.Drawing.Size(30, 30); + this.picSyncStatus.TabIndex = 39; + this.picSyncStatus.TabStop = false; + // + // picNetStatus + // + this.picNetStatus.ErrorImage = null; + this.picNetStatus.InitialImage = null; + this.picNetStatus.Location = new System.Drawing.Point(415, 20); + this.picNetStatus.Name = "picNetStatus"; + this.picNetStatus.Size = new System.Drawing.Size(30, 30); + this.picNetStatus.TabIndex = 39; + this.picNetStatus.TabStop = false; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(380, 76); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(29, 12); + this.label11.TabIndex = 35; + this.label11.Text = "同步"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(380, 28); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(29, 12); + this.label10.TabIndex = 35; + this.label10.Text = "网络"; + // + // panel3 + // + this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel3.Controls.Add(this.cbxWorkUnit); + this.panel3.Controls.Add(this.label5); + this.panel3.Controls.Add(this.cbxWorkShop); + this.panel3.Controls.Add(this.label4); + this.panel3.Location = new System.Drawing.Point(569, 3); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(191, 114); + this.panel3.TabIndex = 34; + // + // cbxWorkUnit + // + this.cbxWorkUnit.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbxWorkUnit.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.cbxWorkUnit.FormattingEnabled = true; + this.cbxWorkUnit.Location = new System.Drawing.Point(57, 48); + this.cbxWorkUnit.Name = "cbxWorkUnit"; + this.cbxWorkUnit.Size = new System.Drawing.Size(121, 24); + this.cbxWorkUnit.TabIndex = 40; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(9, 55); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(41, 12); + this.label5.TabIndex = 37; + this.label5.Text = "单元:"; + // + // cbxWorkShop + // + this.cbxWorkShop.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbxWorkShop.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.cbxWorkShop.FormattingEnabled = true; + this.cbxWorkShop.Location = new System.Drawing.Point(57, 7); + this.cbxWorkShop.Name = "cbxWorkShop"; + this.cbxWorkShop.Size = new System.Drawing.Size(121, 24); + this.cbxWorkShop.TabIndex = 41; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(9, 11); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(41, 12); + this.label4.TabIndex = 38; + this.label4.Text = "车间:"; + // + // panel2 + // + this.panel2.BackColor = System.Drawing.Color.Black; + this.panel2.Controls.Add(this.lblChengZhong); + this.panel2.Location = new System.Drawing.Point(4, 19); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(224, 78); + this.panel2.TabIndex = 32; + // + // lblChengZhong + // + this.lblChengZhong.AutoSize = true; + this.lblChengZhong.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblChengZhong.ForeColor = System.Drawing.Color.Red; + this.lblChengZhong.Location = new System.Drawing.Point(15, 18); + this.lblChengZhong.Name = "lblChengZhong"; + this.lblChengZhong.Size = new System.Drawing.Size(97, 40); + this.lblChengZhong.TabIndex = 0; + this.lblChengZhong.Text = "0.00"; + // + // btnWeightSet + // + this.btnWeightSet.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnWeightSet.Location = new System.Drawing.Point(247, 62); + this.btnWeightSet.Name = "btnWeightSet"; + this.btnWeightSet.Size = new System.Drawing.Size(111, 33); + this.btnWeightSet.TabIndex = 0; + this.btnWeightSet.Text = "称设置"; + this.btnWeightSet.UseVisualStyleBackColor = true; + // + // dataGridViewSubmited + // + this.dataGridViewSubmited.AllowUserToAddRows = false; + this.dataGridViewSubmited.AllowUserToDeleteRows = false; + this.dataGridViewSubmited.AllowUserToResizeColumns = false; + this.dataGridViewSubmited.AllowUserToResizeRows = false; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.dataGridViewSubmited.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + this.dataGridViewSubmited.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridViewSubmited.BackgroundColor = System.Drawing.Color.White; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridViewSubmited.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + this.dataGridViewSubmited.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridViewSubmited.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.dataGridViewTextBoxColumn1, + this.dataGridViewTextBoxColumn2, + this.dataGridViewTextBoxColumn3, + this.dataGridViewTextBoxColumn4, + this.dataGridViewTextBoxColumn5, + this.dataGridViewTextBoxColumn6, + this.dataGridViewTextBoxColumn7}); + this.dataGridViewSubmited.Location = new System.Drawing.Point(6, 21); + this.dataGridViewSubmited.MultiSelect = false; + this.dataGridViewSubmited.Name = "dataGridViewSubmited"; + this.dataGridViewSubmited.ReadOnly = true; + this.dataGridViewSubmited.RowHeadersVisible = false; + dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.dataGridViewSubmited.RowsDefaultCellStyle = dataGridViewCellStyle3; + this.dataGridViewSubmited.RowTemplate.Height = 23; + this.dataGridViewSubmited.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dataGridViewSubmited.Size = new System.Drawing.Size(761, 177); + this.dataGridViewSubmited.TabIndex = 2; + // + // un序号 + // + this.un序号.HeaderText = "序号"; + this.un序号.Name = "un序号"; + this.un序号.ReadOnly = true; + this.un序号.Width = 80; + // + // un条码 + // + this.un条码.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.un条码.HeaderText = "条码"; + this.un条码.Name = "un条码"; + this.un条码.ReadOnly = true; + this.un条码.Width = 65; + // + // un编码 + // + this.un编码.HeaderText = "编码"; + this.un编码.Name = "un编码"; + this.un编码.ReadOnly = true; + // + // un名称 + // + this.un名称.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.un名称.HeaderText = "名称"; + this.un名称.Name = "un名称"; + this.un名称.ReadOnly = true; + this.un名称.Width = 65; + // + // un重量 + // + this.un重量.HeaderText = "重量"; + this.un重量.Name = "un重量"; + this.un重量.ReadOnly = true; + // + // un单位 + // + this.un单位.HeaderText = "单位"; + this.un单位.Name = "un单位"; + this.un单位.ReadOnly = true; + // + // un数量 + // + this.un数量.HeaderText = "数量"; + this.un数量.Name = "un数量"; + this.un数量.ReadOnly = true; + // + // dataGridViewTextBoxColumn1 + // + this.dataGridViewTextBoxColumn1.HeaderText = "序号"; + this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1"; + this.dataGridViewTextBoxColumn1.ReadOnly = true; + this.dataGridViewTextBoxColumn1.Width = 80; + // + // dataGridViewTextBoxColumn2 + // + this.dataGridViewTextBoxColumn2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.dataGridViewTextBoxColumn2.HeaderText = "条码"; + this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2"; + this.dataGridViewTextBoxColumn2.ReadOnly = true; + this.dataGridViewTextBoxColumn2.Width = 65; + // + // dataGridViewTextBoxColumn3 + // + this.dataGridViewTextBoxColumn3.HeaderText = "编码"; + this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3"; + this.dataGridViewTextBoxColumn3.ReadOnly = true; + // + // dataGridViewTextBoxColumn4 + // + this.dataGridViewTextBoxColumn4.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.dataGridViewTextBoxColumn4.HeaderText = "名称"; + this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4"; + this.dataGridViewTextBoxColumn4.ReadOnly = true; + this.dataGridViewTextBoxColumn4.Width = 65; + // + // dataGridViewTextBoxColumn5 + // + this.dataGridViewTextBoxColumn5.HeaderText = "重量"; + this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5"; + this.dataGridViewTextBoxColumn5.ReadOnly = true; + // + // dataGridViewTextBoxColumn6 + // + this.dataGridViewTextBoxColumn6.HeaderText = "单位"; + this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6"; + this.dataGridViewTextBoxColumn6.ReadOnly = true; + // + // dataGridViewTextBoxColumn7 + // + this.dataGridViewTextBoxColumn7.HeaderText = "数量"; + this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7"; + this.dataGridViewTextBoxColumn7.ReadOnly = true; + // + // panel4 + // + this.panel4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel4.Controls.Add(this.textBox3); + this.panel4.Controls.Add(this.label3); + this.panel4.Controls.Add(this.textBox2); + this.panel4.Controls.Add(this.label2); + this.panel4.Controls.Add(this.textBox1); + this.panel4.Controls.Add(this.label1); + this.panel4.Location = new System.Drawing.Point(3, 8); + this.panel4.Name = "panel4"; + this.panel4.Size = new System.Drawing.Size(339, 197); + this.panel4.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(4, 14); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(29, 12); + this.label1.TabIndex = 0; + this.label1.Text = "条码"; + // + // textBox1 + // + this.textBox1.Enabled = false; + this.textBox1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(39, 7); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(290, 26); + this.textBox1.TabIndex = 1; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(4, 51); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(29, 12); + this.label2.TabIndex = 0; + this.label2.Text = "品名"; + // + // textBox2 + // + this.textBox2.Enabled = false; + this.textBox2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(39, 44); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(290, 26); + this.textBox2.TabIndex = 1; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(4, 94); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(29, 12); + this.label3.TabIndex = 0; + this.label3.Text = "重量"; + // + // textBox3 + // + this.textBox3.Enabled = false; + this.textBox3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox3.Location = new System.Drawing.Point(39, 87); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(113, 26); + this.textBox3.TabIndex = 1; + // + // MaterialRequisitionForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1131, 625); + this.Controls.Add(this.splitContainer1); + this.MinimizeBox = false; + this.Name = "MaterialRequisitionForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "领料退料"; + this.WindowState = System.Windows.Forms.FormWindowState.Maximized; + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.groupBox2.ResumeLayout(false); + this.groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dataGridViewUnSubmit)).EndInit(); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.picSyncStatus)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picNetStatus)).EndInit(); + this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridViewSubmited)).EndInit(); + this.panel4.ResumeLayout(false); + this.panel4.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Button btnEnableWeight; + private System.Windows.Forms.PictureBox picSyncStatus; + private System.Windows.Forms.PictureBox picNetStatus; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.ComboBox cbxWorkUnit; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.ComboBox cbxWorkShop; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Label lblChengZhong; + private System.Windows.Forms.Button btnWeightSet; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Button btnDelete; + private System.Windows.Forms.Button btnCommit; + private BWP.WinFormControl.UDataGridView dataGridViewUnSubmit; + private System.Windows.Forms.GroupBox groupBox2; + private BWP.WinFormControl.UDataGridView dataGridViewSubmited; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn5; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn6; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn7; + private System.Windows.Forms.DataGridViewTextBoxColumn un序号; + private System.Windows.Forms.DataGridViewTextBoxColumn un条码; + private System.Windows.Forms.DataGridViewTextBoxColumn un编码; + private System.Windows.Forms.DataGridViewTextBoxColumn un名称; + private System.Windows.Forms.DataGridViewTextBoxColumn un重量; + private System.Windows.Forms.DataGridViewTextBoxColumn un单位; + private System.Windows.Forms.DataGridViewTextBoxColumn un数量; + private System.Windows.Forms.Panel panel4; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Label label3; + } +} + diff --git a/MaterialRequisition/MaterialRequisitionForm.cs b/MaterialRequisition/MaterialRequisitionForm.cs new file mode 100644 index 0000000..a2b87ae --- /dev/null +++ b/MaterialRequisition/MaterialRequisitionForm.cs @@ -0,0 +1,238 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.IO.Ports; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using BO; +using BO.Utils; +using BWP.WinFormControl.WeightDataFormat; +using Forks.JsonRpc.Client; +using MaterialRequisition.Model; +using Newtonsoft.Json; + +namespace MaterialRequisition +{ + public partial class MaterialRequisitionForm : Form,IAfterLogin + { + + public string RoleName { get { return "领料退料"; } } + public Form Generate() + { + return this; + } + + private readonly string mDropDownSetsFileName = "MaterialRequisition_DropDownSets.xml"; + private DropDownSets mDropDownSets; + #region weightNeed + SerialPort weightPort; + private IDataFormat _dataFormat; + private Thread _inQueryThread; + private bool _mainProcessIsRun; + readonly StringBuilder _dataStrBuilder = new StringBuilder(); + #endregion + + private readonly Thread _tdSyncLocalToMiddleDb; + private readonly Thread _tcCheckNetStatus; + private readonly Thread _tcCheckSyncStatus; + public MaterialRequisitionForm() + { + InitializeComponent(); + dataGridViewUnSubmit.AutoGenerateColumns = false; + dataGridViewSubmited.AutoGenerateColumns = false; + weightPort = new SerialPort(); + this.FormClosing += delegate + { + if (_inQueryThread != null && _inQueryThread.IsAlive) + { + //DisableWeight(); + } + if (_tdSyncLocalToMiddleDb != null && _tdSyncLocalToMiddleDb.IsAlive) + { + _tdSyncLocalToMiddleDb.Abort(); + } + if (_tcCheckNetStatus != null && _tcCheckNetStatus.IsAlive) + { + _tcCheckNetStatus.Abort(); + } + if (_tcCheckSyncStatus != null && _tcCheckSyncStatus.IsAlive) + { + _tcCheckSyncStatus.Abort(); + } + }; + + InitCombox(); + _tdSyncLocalToMiddleDb = new Thread(SyncLocalToMiddleDb); + _tdSyncLocalToMiddleDb.Start(); + + _tcCheckNetStatus = new Thread(CheckNetStatus); + _tcCheckNetStatus.Start(); + + _tcCheckSyncStatus = new Thread(CheckSyncStatus); + _tcCheckSyncStatus.Start(); + + } + private void CheckSyncStatus() + { + while (true) + { + var syncSuccessed = MaterialRequisitionRecordRpc.GetInstance().IsSyncSucessed(); + var png = "stop.png"; + if (syncSuccessed) + png = "working.png"; + var imgPath = Path.Combine(Application.StartupPath, "BWP.WinFormControl.dll"); + var s = Assembly.LoadFile(imgPath).GetManifestResourceStream("BWP.WinFormControl.Images." + png); + if (this.InvokeRequired) + { + this.BeginInvoke(new Action(() => + { + picSyncStatus.Image = Image.FromStream(s); + picSyncStatus.Refresh(); + })); + } + else + { + picSyncStatus.Image = Image.FromStream(s); + picSyncStatus.Refresh(); + } + Thread.Sleep(1000); + } + } + + private bool laseConnection = false; + + private void CheckNetStatus() + { + while (true) + { + try + { + var newConnection = LoginRpcUtil.TestConnection(500); + if (newConnection && laseConnection) + { + Thread.Sleep(1000); + continue; + } + var png = "stop.png"; + if (newConnection) + png = "working.png"; + var imgPath = Path.Combine(Application.StartupPath, "BWP.WinFormControl.dll"); + var s = Assembly.LoadFile(imgPath).GetManifestResourceStream("BWP.WinFormControl.Images." + png); + if (this.InvokeRequired) + { + this.BeginInvoke(new Action(() => + { + picNetStatus.Image = Image.FromStream(s); + picNetStatus.Refresh(); + })); + } + else + { + picNetStatus.Image = Image.FromStream(s); + picNetStatus.Refresh(); + } + laseConnection = newConnection; + } + catch (Exception e) + { + //LogUtil.Error(e.ToString()); + } + + Thread.Sleep(1000); + } + } + + private void SyncLocalToMiddleDb() + { + while (true) + { + if (laseConnection) + { + this.BeginInvoke(new Action(() => + { + MaterialRequisitionRecordRpc.GetInstance().SyncToServer(); + })); + + } + Thread.Sleep(1000); + } + } + + + private void InitCombox() + { + if (LoginRpcUtil.TestConnection(500)) + { + mDropDownSets = GetmDropDownSets(); + XmlUtil.SerializerObjToFile(mDropDownSets, mDropDownSetsFileName); + } + else + { + mDropDownSets = XmlUtil.DeserializeFromFile(mDropDownSetsFileName); + } + var shop = mDropDownSets.Details.FirstOrDefault(x => x.Name == DropDownSets.车间); + if (shop != null) + { + cbxWorkShop.DataSource = shop.Details; + cbxWorkShop.DisplayMember = "Name"; + cbxWorkShop.ValueMember = "ID"; + } + + var unit = mDropDownSets.Details.FirstOrDefault(x => x.Name == DropDownSets.单元); + if (unit != null) + { + cbxWorkUnit.DataSource = unit.Details; + cbxWorkUnit.DisplayMember = "Name"; + cbxWorkUnit.ValueMember = "Code"; + } + + } + + private DropDownSets GetmDropDownSets() + { + var sets = new DropDownSets(); + var wrokUnitSet = GetWrokUnitSet(); + var wrokShopSet = GetWrokShopSet(); + sets.Details.Add(wrokUnitSet); + sets.Details.Add(wrokShopSet); + return sets; + } + + + + private DropDownSet GetWrokShopSet() + { + var json = RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BaseInfoRpc/GetWorkShopList"); + var set = new DropDownSet(); + set.Name = DropDownSets.车间; + foreach (var detail in JsonConvert.DeserializeObject>(json)) + { + set.Details.Add(detail); + } + return set; + } + + private DropDownSet GetWrokUnitSet() + { + var json = RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BaseInfoRpc/GetWorkUnitList"); + var set = new DropDownSet(); + set.Name = DropDownSets.单元; + foreach (var detail in JsonConvert.DeserializeObject>(json)) + { + set.Details.Add(detail); + } + return set; + } + + + + } +} diff --git a/MaterialRequisition/MaterialRequisitionForm.resx b/MaterialRequisition/MaterialRequisitionForm.resx new file mode 100644 index 0000000..8197078 --- /dev/null +++ b/MaterialRequisition/MaterialRequisitionForm.resx @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/MaterialRequisition/Model/MaterialRequisitionRecord.cs b/MaterialRequisition/Model/MaterialRequisitionRecord.cs new file mode 100644 index 0000000..aabc604 --- /dev/null +++ b/MaterialRequisition/Model/MaterialRequisitionRecord.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using AutoMapper; +using BO.BO; +using Forks.EnterpriseServices.DataForm; +using Forks.EnterpriseServices.DomainObjects2; +using Newtonsoft.Json; + +namespace MaterialRequisition.Model +{ + [Serializable] + [MapToTable("MaterialRequisitionRecord")] + public class MaterialRequisitionRecord : LocalSyncBase + { + [NonDmoProperty] + public int Index { get; set; } + + public string BarCode { get; set; }//条码 + public long Goods_ID { get; set; } + public string Goods_Name { get; set; } + public string Goods_Spec { get; set; } + public decimal Weight { get; set; }//皮重 + public string CardBarCode { get; set; }//放产品的车的条码 + public string BiaoShi { get; set; } + + public override string GetDtoJson() + { + var config = new MapperConfiguration(cfg => { + cfg.CreateMap(); + }); + var mapper = config.CreateMapper(); + var dto = mapper.Map(this); + dto.Client_ID = this.ID; + return JsonConvert.SerializeObject(dto); + } + + } +} diff --git a/MaterialRequisition/Model/MaterialRequisitionRecordDto.cs b/MaterialRequisition/Model/MaterialRequisitionRecordDto.cs new file mode 100644 index 0000000..77de943 --- /dev/null +++ b/MaterialRequisition/Model/MaterialRequisitionRecordDto.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BO.BO.Dtos; +using Forks.EnterpriseServices.DataForm; + +namespace MaterialRequisition.Model +{ + + [DFClass] + public class MaterialRequisitionRecordDto : SyncBaseDto + { + public string BarCode { get; set; } //条码 + public long Goods_ID { get; set; } + public string Goods_Name { get; set; } + public string Goods_Spec { get; set; } + public decimal Weight { get; set; } //皮重 + public string CardBarCode { get; set; } //放产品的车的条码 + public string BiaoShi { get; set; } + + } +} \ No newline at end of file diff --git a/MaterialRequisition/Model/MaterialRequisitionRecordRpc.cs b/MaterialRequisition/Model/MaterialRequisitionRecordRpc.cs new file mode 100644 index 0000000..0bff7ff --- /dev/null +++ b/MaterialRequisition/Model/MaterialRequisitionRecordRpc.cs @@ -0,0 +1,61 @@ +using BO; + +namespace MaterialRequisition.Model +{ + + public class MaterialRequisitionRecordRpc : SyncToServerBase + { + // 定义一个静态变量来保存类的实例 + private static MaterialRequisitionRecordRpc uniqueInstance; + + // 定义一个标识确保线程同步 + private static readonly object locker = new object(); + + // 定义私有构造函数,使外界不能创建该类实例 + private MaterialRequisitionRecordRpc() + { + } + + /// + /// 定义公有方法提供一个全局访问点,同时你也可以定义公有属性来提供全局访问点 + /// + /// + public static MaterialRequisitionRecordRpc GetInstance() + { + // 当第一个线程运行到这里时,此时会对locker对象 "加锁", + // 当第二个线程运行该方法时,首先检测到locker对象为"加锁"状态,该线程就会挂起等待第一个线程解锁 + // lock语句运行完之后(即线程运行完之后)会对该对象"解锁" + // 双重锁定只需要一句判断就可以了 + if (uniqueInstance == null) + { + lock (locker) + { + // 如果类的实例不存在则创建,否则直接返回 + if (uniqueInstance == null) + { + uniqueInstance = new MaterialRequisitionRecordRpc(); + } + } + } + return uniqueInstance; + } + + + protected override string InsertRpcUrl + { + get { return "/MainSystem/B3ClientService/Rpcs/BillRpc/MaterialRequisitionRecordRpc/Insert"; } + } + + protected override string UpdateRpcUrl + { + get { return "/MainSystem/B3ClientService/Rpcs/BillRpc/MaterialRequisitionRecordRpc/Update"; } + } + + protected override string DeleteRpcUrl + { + get { return "/MainSystem/B3ClientService/Rpcs/BillRpc/MaterialRequisitionRecordRpc/Delete"; } + } + + + } +} diff --git a/MaterialRequisition/Program.cs b/MaterialRequisition/Program.cs new file mode 100644 index 0000000..8ef5ee0 --- /dev/null +++ b/MaterialRequisition/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace MaterialRequisition +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new MaterialRequisitionForm()); + } + } +} diff --git a/MaterialRequisition/Properties/AssemblyInfo.cs b/MaterialRequisition/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..653e6ba --- /dev/null +++ b/MaterialRequisition/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("MaterialRequisition")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MaterialRequisition")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("756cb09c-d46e-4bfd-8417-4ea531102e4a")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 +// 方法是按如下所示使用“*”: : +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/MaterialRequisition/Properties/Resources.Designer.cs b/MaterialRequisition/Properties/Resources.Designer.cs new file mode 100644 index 0000000..516bad3 --- /dev/null +++ b/MaterialRequisition/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace MaterialRequisition.Properties +{ + + + /// + /// 强类型资源类,用于查找本地化字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// 返回此类使用的缓存 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MaterialRequisition.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 覆盖当前线程的 CurrentUICulture 属性 + /// 使用此强类型的资源类的资源查找。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/MaterialRequisition/Properties/Resources.resx b/MaterialRequisition/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/MaterialRequisition/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MaterialRequisition/Properties/Settings.Designer.cs b/MaterialRequisition/Properties/Settings.Designer.cs new file mode 100644 index 0000000..3ef12a0 --- /dev/null +++ b/MaterialRequisition/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace MaterialRequisition.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/MaterialRequisition/Properties/Settings.settings b/MaterialRequisition/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/MaterialRequisition/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/WinFormTest/Form1.Designer.cs b/WinFormTest/Form1.Designer.cs index af9164d..9a4edd4 100644 --- a/WinFormTest/Form1.Designer.cs +++ b/WinFormTest/Form1.Designer.cs @@ -29,25 +29,47 @@ private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.weightControl1 = new BWP.WinFormControl.WeightControl_.WeightControl(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(40, 98); + this.label1.Location = new System.Drawing.Point(39, 21); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(41, 12); this.label1.TabIndex = 0; this.label1.Text = "label1"; // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(205, 324); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(41, 12); + this.label2.TabIndex = 2; + this.label2.Text = "label2"; + // + // weightControl1 + // + this.weightControl1.ApplyTo = BWP.WinFormControl.WeightControl_.ApplyTo.领料退料; + this.weightControl1.Location = new System.Drawing.Point(76, 101); + this.weightControl1.Name = "weightControl1"; + this.weightControl1.Size = new System.Drawing.Size(303, 143); + this.weightControl1.TabIndex = 3; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(601, 452); + this.Controls.Add(this.weightControl1); + this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Name = "Form1"; this.Text = "Form1"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed); this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); @@ -58,6 +80,8 @@ #endregion private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private BWP.WinFormControl.WeightControl_.WeightControl weightControl1; } } diff --git a/WinFormTest/Form1.cs b/WinFormTest/Form1.cs index 1a51ec0..d195be0 100644 --- a/WinFormTest/Form1.cs +++ b/WinFormTest/Form1.cs @@ -46,12 +46,23 @@ namespace WinFormTest private void Form1_Load(object sender, EventArgs e) { + weightControl1.WeightEventHandle += WeightControl1_WeightEventHandle; BarCode.Start(); } + private void WeightControl1_WeightEventHandle(object sender, BWP.WinFormControl.WeightControl_.WeightEventArgu e) + { + label2.Text = e.WeightData; + } + private void Form1_FormClosed(object sender, FormClosedEventArgs e) { BarCode.Stop(); } + + private void Form1_FormClosing(object sender, FormClosingEventArgs e) + { + weightControl1.Close(); + } } }