| @ -1,7 +1,7 @@ | |||
| using System.Windows.Forms; | |||
| namespace BWP.WinFormControl | |||
| { | |||
| partial class WeightControl | |||
| partial class WeightControlYiBo | |||
| { | |||
| /// <summary> | |||
| /// 必需的设计器变量。 | |||
| @ -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<WeightConfigs>(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<WeightConfig>(); | |||
| } | |||
| public List<WeightConfig> 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 | |||
| } | |||
| } | |||
| @ -0,0 +1,132 @@ | |||
| namespace BWP.WinFormControl.WeightControl_ | |||
| { | |||
| partial class WeightControl | |||
| { | |||
| /// <summary> | |||
| /// 必需的设计器变量。 | |||
| /// </summary> | |||
| private System.ComponentModel.IContainer components = null; | |||
| /// <summary> | |||
| /// 清理所有正在使用的资源。 | |||
| /// </summary> | |||
| /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> | |||
| protected override void Dispose(bool disposing) | |||
| { | |||
| if (disposing && (components != null)) | |||
| { | |||
| components.Dispose(); | |||
| } | |||
| base.Dispose(disposing); | |||
| } | |||
| #region 组件设计器生成的代码 | |||
| /// <summary> | |||
| /// 设计器支持所需的方法 - 不要修改 | |||
| /// 使用代码编辑器修改此方法的内容。 | |||
| /// </summary> | |||
| 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; | |||
| } | |||
| } | |||
| @ -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<Tuple<decimal, bool>> 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<List<Tuple<decimal, bool>>> mWeighList = new ConcurrentQueue<List<Tuple<decimal, bool>>>(); | |||
| static List<Tuple<decimal, bool>> _list = new List<Tuple<decimal, bool>>(); | |||
| public static void Add(WeightConfig weightConfig, decimal value, bool isStatic) | |||
| { | |||
| if (value >= weightConfig.MinWeight && value <= weightConfig.MaxWeight) | |||
| { | |||
| _list.Add(new Tuple<decimal, bool>(value, isStatic)); | |||
| } | |||
| else | |||
| { | |||
| if (_list.Count > 0) | |||
| { | |||
| mWeighList.Enqueue(_list); | |||
| _list = new List<Tuple<decimal, bool>>(); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| 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; | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,141 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <root> | |||
| <!-- | |||
| Microsoft ResX Schema | |||
| Version 2.0 | |||
| The primary goals of this format is to allow a simple XML format | |||
| that is mostly human readable. The generation and parsing of the | |||
| various data types are done through the TypeConverter classes | |||
| associated with the data types. | |||
| Example: | |||
| ... ado.net/XML headers & schema ... | |||
| <resheader name="resmimetype">text/microsoft-resx</resheader> | |||
| <resheader name="version">2.0</resheader> | |||
| <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | |||
| <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | |||
| <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | |||
| <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | |||
| <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | |||
| <value>[base64 mime encoded serialized .NET Framework object]</value> | |||
| </data> | |||
| <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||
| <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | |||
| <comment>This is a comment</comment> | |||
| </data> | |||
| There are any number of "resheader" rows that contain simple | |||
| name/value pairs. | |||
| Each data row contains a name, and value. The row also contains a | |||
| type or mimetype. Type corresponds to a .NET class that support | |||
| text/value conversion through the TypeConverter architecture. | |||
| Classes that don't support this are serialized and stored with the | |||
| mimetype set. | |||
| The mimetype is used for serialized objects, and tells the | |||
| ResXResourceReader how to depersist the object. This is currently not | |||
| extensible. For a given mimetype the value must be set accordingly: | |||
| Note - application/x-microsoft.net.object.binary.base64 is the format | |||
| that the ResXResourceWriter will generate, however the reader can | |||
| read any of the formats listed below. | |||
| mimetype: application/x-microsoft.net.object.binary.base64 | |||
| value : The object must be serialized with | |||
| : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | |||
| : and then encoded with base64 encoding. | |||
| mimetype: application/x-microsoft.net.object.soap.base64 | |||
| value : The object must be serialized with | |||
| : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | |||
| : and then encoded with base64 encoding. | |||
| mimetype: application/x-microsoft.net.object.bytearray.base64 | |||
| value : The object must be serialized into a byte array | |||
| : using a System.ComponentModel.TypeConverter | |||
| : and then encoded with base64 encoding. | |||
| --> | |||
| <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | |||
| <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | |||
| <xsd:element name="root" msdata:IsDataSet="true"> | |||
| <xsd:complexType> | |||
| <xsd:choice maxOccurs="unbounded"> | |||
| <xsd:element name="metadata"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" use="required" type="xsd:string" /> | |||
| <xsd:attribute name="type" type="xsd:string" /> | |||
| <xsd:attribute name="mimetype" type="xsd:string" /> | |||
| <xsd:attribute ref="xml:space" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="assembly"> | |||
| <xsd:complexType> | |||
| <xsd:attribute name="alias" type="xsd:string" /> | |||
| <xsd:attribute name="name" type="xsd:string" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="data"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||
| <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | |||
| <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | |||
| <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | |||
| <xsd:attribute ref="xml:space" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="resheader"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" type="xsd:string" use="required" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| </xsd:choice> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| </xsd:schema> | |||
| <resheader name="resmimetype"> | |||
| <value>text/microsoft-resx</value> | |||
| </resheader> | |||
| <resheader name="version"> | |||
| <value>2.0</value> | |||
| </resheader> | |||
| <resheader name="reader"> | |||
| <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| <resheader name="writer"> | |||
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| <metadata name="btnStartWeight.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="panel2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="lblChengZhong.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="lblChengZhong.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="btnWeightSet.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="btnEndWeight.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| </root> | |||
| @ -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)); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,277 @@ | |||
| namespace BWP.WinFormControl.WeightControl_ | |||
| { | |||
| partial class WeightSetForm | |||
| { | |||
| /// <summary> | |||
| /// Required designer variable. | |||
| /// </summary> | |||
| private System.ComponentModel.IContainer components = null; | |||
| /// <summary> | |||
| /// Clean up any resources being used. | |||
| /// </summary> | |||
| /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> | |||
| protected override void Dispose(bool disposing) | |||
| { | |||
| if (disposing && (components != null)) | |||
| { | |||
| components.Dispose(); | |||
| } | |||
| base.Dispose(disposing); | |||
| } | |||
| #region Windows Form Designer generated code | |||
| /// <summary> | |||
| /// Required method for Designer support - do not modify | |||
| /// the contents of this method with the code editor. | |||
| /// </summary> | |||
| 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; | |||
| } | |||
| } | |||
| @ -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<string> weight = new List<string> { "IND560", "Xk3124", "Xk3190A9", "Xk3190D10", "IND231" }; | |||
| List<string> com = new List<string> { "COM1", "COM2", "COM3", "COM4", "COM5" }; | |||
| List<string> rate = new List<string> { "1200", "2400", "4800", "7200", "9600" }; | |||
| List<string> bit = new List<string> { "5", "6", "7", "8" }; | |||
| List<string> weightRead = new List<string> { "稳定读取", "连续发送" }; | |||
| 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(); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,120 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <root> | |||
| <!-- | |||
| Microsoft ResX Schema | |||
| Version 2.0 | |||
| The primary goals of this format is to allow a simple XML format | |||
| that is mostly human readable. The generation and parsing of the | |||
| various data types are done through the TypeConverter classes | |||
| associated with the data types. | |||
| Example: | |||
| ... ado.net/XML headers & schema ... | |||
| <resheader name="resmimetype">text/microsoft-resx</resheader> | |||
| <resheader name="version">2.0</resheader> | |||
| <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | |||
| <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | |||
| <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | |||
| <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | |||
| <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | |||
| <value>[base64 mime encoded serialized .NET Framework object]</value> | |||
| </data> | |||
| <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||
| <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | |||
| <comment>This is a comment</comment> | |||
| </data> | |||
| There are any number of "resheader" rows that contain simple | |||
| name/value pairs. | |||
| Each data row contains a name, and value. The row also contains a | |||
| type or mimetype. Type corresponds to a .NET class that support | |||
| text/value conversion through the TypeConverter architecture. | |||
| Classes that don't support this are serialized and stored with the | |||
| mimetype set. | |||
| The mimetype is used for serialized objects, and tells the | |||
| ResXResourceReader how to depersist the object. This is currently not | |||
| extensible. For a given mimetype the value must be set accordingly: | |||
| Note - application/x-microsoft.net.object.binary.base64 is the format | |||
| that the ResXResourceWriter will generate, however the reader can | |||
| read any of the formats listed below. | |||
| mimetype: application/x-microsoft.net.object.binary.base64 | |||
| value : The object must be serialized with | |||
| : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | |||
| : and then encoded with base64 encoding. | |||
| mimetype: application/x-microsoft.net.object.soap.base64 | |||
| value : The object must be serialized with | |||
| : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | |||
| : and then encoded with base64 encoding. | |||
| mimetype: application/x-microsoft.net.object.bytearray.base64 | |||
| value : The object must be serialized into a byte array | |||
| : using a System.ComponentModel.TypeConverter | |||
| : and then encoded with base64 encoding. | |||
| --> | |||
| <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | |||
| <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | |||
| <xsd:element name="root" msdata:IsDataSet="true"> | |||
| <xsd:complexType> | |||
| <xsd:choice maxOccurs="unbounded"> | |||
| <xsd:element name="metadata"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" use="required" type="xsd:string" /> | |||
| <xsd:attribute name="type" type="xsd:string" /> | |||
| <xsd:attribute name="mimetype" type="xsd:string" /> | |||
| <xsd:attribute ref="xml:space" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="assembly"> | |||
| <xsd:complexType> | |||
| <xsd:attribute name="alias" type="xsd:string" /> | |||
| <xsd:attribute name="name" type="xsd:string" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="data"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||
| <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | |||
| <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | |||
| <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | |||
| <xsd:attribute ref="xml:space" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="resheader"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" type="xsd:string" use="required" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| </xsd:choice> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| </xsd:schema> | |||
| <resheader name="resmimetype"> | |||
| <value>text/microsoft-resx</value> | |||
| </resheader> | |||
| <resheader name="version"> | |||
| <value>2.0</value> | |||
| </resheader> | |||
| <resheader name="reader"> | |||
| <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| <resheader name="writer"> | |||
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| </root> | |||
| @ -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<T>(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<T>(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; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,6 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | |||
| <configuration> | |||
| <startup> | |||
| <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> | |||
| </startup> | |||
| </configuration> | |||
| @ -0,0 +1,115 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
| <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | |||
| <PropertyGroup> | |||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
| <ProjectGuid>{756CB09C-D46E-4BFD-8417-4EA531102E4A}</ProjectGuid> | |||
| <OutputType>WinExe</OutputType> | |||
| <RootNamespace>MaterialRequisition</RootNamespace> | |||
| <AssemblyName>MaterialRequisition</AssemblyName> | |||
| <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | |||
| <FileAlignment>512</FileAlignment> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
| <PlatformTarget>AnyCPU</PlatformTarget> | |||
| <DebugSymbols>true</DebugSymbols> | |||
| <DebugType>full</DebugType> | |||
| <Optimize>false</Optimize> | |||
| <OutputPath>bin\Debug\</OutputPath> | |||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
| <PlatformTarget>AnyCPU</PlatformTarget> | |||
| <DebugType>pdbonly</DebugType> | |||
| <Optimize>true</Optimize> | |||
| <OutputPath>bin\Release\</OutputPath> | |||
| <DefineConstants>TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <Reference Include="AutoMapper"> | |||
| <HintPath>..\ButcherManageClient\bin\Debug\AutoMapper.dll</HintPath> | |||
| </Reference> | |||
| <Reference Include="Forks.EnterpriseServices, Version=3.1.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL"> | |||
| <SpecificVersion>False</SpecificVersion> | |||
| <HintPath>..\..\..\tsref\Debug\Forks.EnterpriseServices.dll</HintPath> | |||
| </Reference> | |||
| <Reference Include="Forks.JsonRpc.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL" /> | |||
| <Reference Include="Forks.Utils, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL"> | |||
| <SpecificVersion>False</SpecificVersion> | |||
| <HintPath>..\..\..\tsref\Debug\Forks.Utils.dll</HintPath> | |||
| </Reference> | |||
| <Reference Include="Newtonsoft.Json, Version=4.0.3.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | |||
| <SpecificVersion>False</SpecificVersion> | |||
| <HintPath>..\..\..\tsref\Debug\Newtonsoft.Json.dll</HintPath> | |||
| </Reference> | |||
| <Reference Include="PresentationCore" /> | |||
| <Reference Include="PresentationFramework" /> | |||
| <Reference Include="System" /> | |||
| <Reference Include="System.Core" /> | |||
| <Reference Include="System.Xaml" /> | |||
| <Reference Include="System.Xml.Linq" /> | |||
| <Reference Include="System.Data.DataSetExtensions" /> | |||
| <Reference Include="Microsoft.CSharp" /> | |||
| <Reference Include="System.Data" /> | |||
| <Reference Include="System.Deployment" /> | |||
| <Reference Include="System.Drawing" /> | |||
| <Reference Include="System.Net.Http" /> | |||
| <Reference Include="System.Windows.Forms" /> | |||
| <Reference Include="System.Xml" /> | |||
| <Reference Include="WindowsBase" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <Compile Include="MaterialRequisitionForm.cs"> | |||
| <SubType>Form</SubType> | |||
| </Compile> | |||
| <Compile Include="MaterialRequisitionForm.Designer.cs"> | |||
| <DependentUpon>MaterialRequisitionForm.cs</DependentUpon> | |||
| </Compile> | |||
| <Compile Include="Model\MaterialRequisitionRecordDto.cs" /> | |||
| <Compile Include="Model\MaterialRequisitionRecord.cs" /> | |||
| <Compile Include="Model\MaterialRequisitionRecordRpc.cs" /> | |||
| <Compile Include="Program.cs" /> | |||
| <Compile Include="Properties\AssemblyInfo.cs" /> | |||
| <EmbeddedResource Include="MaterialRequisitionForm.resx"> | |||
| <DependentUpon>MaterialRequisitionForm.cs</DependentUpon> | |||
| </EmbeddedResource> | |||
| <EmbeddedResource Include="Properties\Resources.resx"> | |||
| <Generator>ResXFileCodeGenerator</Generator> | |||
| <LastGenOutput>Resources.Designer.cs</LastGenOutput> | |||
| <SubType>Designer</SubType> | |||
| </EmbeddedResource> | |||
| <Compile Include="Properties\Resources.Designer.cs"> | |||
| <AutoGen>True</AutoGen> | |||
| <DependentUpon>Resources.resx</DependentUpon> | |||
| </Compile> | |||
| <None Include="Properties\Settings.settings"> | |||
| <Generator>SettingsSingleFileGenerator</Generator> | |||
| <LastGenOutput>Settings.Designer.cs</LastGenOutput> | |||
| </None> | |||
| <Compile Include="Properties\Settings.Designer.cs"> | |||
| <AutoGen>True</AutoGen> | |||
| <DependentUpon>Settings.settings</DependentUpon> | |||
| <DesignTimeSharedInput>True</DesignTimeSharedInput> | |||
| </Compile> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <None Include="App.config" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <ProjectReference Include="..\BO\BO.csproj"> | |||
| <Project>{8968f14a-c7c7-4751-96ce-b114fbfd65ef}</Project> | |||
| <Name>BO</Name> | |||
| </ProjectReference> | |||
| <ProjectReference Include="..\BWP.WinFormControl\BWP.WinFormControl.csproj"> | |||
| <Project>{A782B23E-BE6D-4F51-B5CB-5CD259BA97CC}</Project> | |||
| <Name>BWP.WinFormControl</Name> | |||
| </ProjectReference> | |||
| </ItemGroup> | |||
| <ItemGroup /> | |||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
| </Project> | |||
| @ -0,0 +1,631 @@ | |||
| namespace MaterialRequisition | |||
| { | |||
| partial class MaterialRequisitionForm | |||
| { | |||
| /// <summary> | |||
| /// 必需的设计器变量。 | |||
| /// </summary> | |||
| private System.ComponentModel.IContainer components = null; | |||
| /// <summary> | |||
| /// 清理所有正在使用的资源。 | |||
| /// </summary> | |||
| /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> | |||
| protected override void Dispose(bool disposing) | |||
| { | |||
| if (disposing && (components != null)) | |||
| { | |||
| components.Dispose(); | |||
| } | |||
| base.Dispose(disposing); | |||
| } | |||
| #region Windows 窗体设计器生成的代码 | |||
| /// <summary> | |||
| /// 设计器支持所需的方法 - 不要修改 | |||
| /// 使用代码编辑器修改此方法的内容。 | |||
| /// </summary> | |||
| 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; | |||
| } | |||
| } | |||
| @ -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<DropDownSets>(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<string>("/MainSystem/B3ClientService/Rpcs/BaseInfoRpc/GetWorkShopList"); | |||
| var set = new DropDownSet(); | |||
| set.Name = DropDownSets.车间; | |||
| foreach (var detail in JsonConvert.DeserializeObject<List<DropDownSet_Detail>>(json)) | |||
| { | |||
| set.Details.Add(detail); | |||
| } | |||
| return set; | |||
| } | |||
| private DropDownSet GetWrokUnitSet() | |||
| { | |||
| var json = RpcFacade.Call<string>("/MainSystem/B3ClientService/Rpcs/BaseInfoRpc/GetWorkUnitList"); | |||
| var set = new DropDownSet(); | |||
| set.Name = DropDownSets.单元; | |||
| foreach (var detail in JsonConvert.DeserializeObject<List<DropDownSet_Detail>>(json)) | |||
| { | |||
| set.Details.Add(detail); | |||
| } | |||
| return set; | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,162 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <root> | |||
| <!-- | |||
| Microsoft ResX Schema | |||
| Version 2.0 | |||
| The primary goals of this format is to allow a simple XML format | |||
| that is mostly human readable. The generation and parsing of the | |||
| various data types are done through the TypeConverter classes | |||
| associated with the data types. | |||
| Example: | |||
| ... ado.net/XML headers & schema ... | |||
| <resheader name="resmimetype">text/microsoft-resx</resheader> | |||
| <resheader name="version">2.0</resheader> | |||
| <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | |||
| <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | |||
| <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | |||
| <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | |||
| <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | |||
| <value>[base64 mime encoded serialized .NET Framework object]</value> | |||
| </data> | |||
| <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||
| <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | |||
| <comment>This is a comment</comment> | |||
| </data> | |||
| There are any number of "resheader" rows that contain simple | |||
| name/value pairs. | |||
| Each data row contains a name, and value. The row also contains a | |||
| type or mimetype. Type corresponds to a .NET class that support | |||
| text/value conversion through the TypeConverter architecture. | |||
| Classes that don't support this are serialized and stored with the | |||
| mimetype set. | |||
| The mimetype is used for serialized objects, and tells the | |||
| ResXResourceReader how to depersist the object. This is currently not | |||
| extensible. For a given mimetype the value must be set accordingly: | |||
| Note - application/x-microsoft.net.object.binary.base64 is the format | |||
| that the ResXResourceWriter will generate, however the reader can | |||
| read any of the formats listed below. | |||
| mimetype: application/x-microsoft.net.object.binary.base64 | |||
| value : The object must be serialized with | |||
| : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | |||
| : and then encoded with base64 encoding. | |||
| mimetype: application/x-microsoft.net.object.soap.base64 | |||
| value : The object must be serialized with | |||
| : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | |||
| : and then encoded with base64 encoding. | |||
| mimetype: application/x-microsoft.net.object.bytearray.base64 | |||
| value : The object must be serialized into a byte array | |||
| : using a System.ComponentModel.TypeConverter | |||
| : and then encoded with base64 encoding. | |||
| --> | |||
| <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | |||
| <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | |||
| <xsd:element name="root" msdata:IsDataSet="true"> | |||
| <xsd:complexType> | |||
| <xsd:choice maxOccurs="unbounded"> | |||
| <xsd:element name="metadata"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" use="required" type="xsd:string" /> | |||
| <xsd:attribute name="type" type="xsd:string" /> | |||
| <xsd:attribute name="mimetype" type="xsd:string" /> | |||
| <xsd:attribute ref="xml:space" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="assembly"> | |||
| <xsd:complexType> | |||
| <xsd:attribute name="alias" type="xsd:string" /> | |||
| <xsd:attribute name="name" type="xsd:string" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="data"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||
| <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | |||
| <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | |||
| <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | |||
| <xsd:attribute ref="xml:space" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="resheader"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" type="xsd:string" use="required" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| </xsd:choice> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| </xsd:schema> | |||
| <resheader name="resmimetype"> | |||
| <value>text/microsoft-resx</value> | |||
| </resheader> | |||
| <resheader name="version"> | |||
| <value>2.0</value> | |||
| </resheader> | |||
| <resheader name="reader"> | |||
| <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| <resheader name="writer"> | |||
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| <metadata name="dataGridViewTextBoxColumn1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="dataGridViewTextBoxColumn2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="dataGridViewTextBoxColumn3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="dataGridViewTextBoxColumn4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="dataGridViewTextBoxColumn5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="dataGridViewTextBoxColumn6.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="dataGridViewTextBoxColumn7.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="un序号.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="un条码.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="un编码.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="un名称.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="un重量.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="un单位.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| <metadata name="un数量.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>True</value> | |||
| </metadata> | |||
| </root> | |||
| @ -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<MaterialRequisitionRecord, MaterialRequisitionRecordDto>(); | |||
| }); | |||
| var mapper = config.CreateMapper(); | |||
| var dto = mapper.Map<MaterialRequisitionRecordDto>(this); | |||
| dto.Client_ID = this.ID; | |||
| return JsonConvert.SerializeObject(dto); | |||
| } | |||
| } | |||
| } | |||
| @ -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; } | |||
| } | |||
| } | |||
| @ -0,0 +1,61 @@ | |||
| using BO; | |||
| namespace MaterialRequisition.Model | |||
| { | |||
| public class MaterialRequisitionRecordRpc : SyncToServerBase<MaterialRequisitionRecord> | |||
| { | |||
| // 定义一个静态变量来保存类的实例 | |||
| private static MaterialRequisitionRecordRpc uniqueInstance; | |||
| // 定义一个标识确保线程同步 | |||
| private static readonly object locker = new object(); | |||
| // 定义私有构造函数,使外界不能创建该类实例 | |||
| private MaterialRequisitionRecordRpc() | |||
| { | |||
| } | |||
| /// <summary> | |||
| /// 定义公有方法提供一个全局访问点,同时你也可以定义公有属性来提供全局访问点 | |||
| /// </summary> | |||
| /// <returns></returns> | |||
| 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"; } | |||
| } | |||
| } | |||
| } | |||
| @ -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 | |||
| { | |||
| /// <summary> | |||
| /// 应用程序的主入口点。 | |||
| /// </summary> | |||
| [STAThread] | |||
| static void Main() | |||
| { | |||
| Application.EnableVisualStyles(); | |||
| Application.SetCompatibleTextRenderingDefault(false); | |||
| Application.Run(new MaterialRequisitionForm()); | |||
| } | |||
| } | |||
| } | |||
| @ -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")] | |||
| @ -0,0 +1,71 @@ | |||
| //------------------------------------------------------------------------------ | |||
| // <auto-generated> | |||
| // 此代码由工具生成。 | |||
| // 运行时版本: 4.0.30319.42000 | |||
| // | |||
| // 对此文件的更改可能导致不正确的行为,如果 | |||
| // 重新生成代码,则所做更改将丢失。 | |||
| // </auto-generated> | |||
| //------------------------------------------------------------------------------ | |||
| namespace MaterialRequisition.Properties | |||
| { | |||
| /// <summary> | |||
| /// 强类型资源类,用于查找本地化字符串等。 | |||
| /// </summary> | |||
| // 此类是由 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() | |||
| { | |||
| } | |||
| /// <summary> | |||
| /// 返回此类使用的缓存 ResourceManager 实例。 | |||
| /// </summary> | |||
| [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; | |||
| } | |||
| } | |||
| /// <summary> | |||
| /// 覆盖当前线程的 CurrentUICulture 属性 | |||
| /// 使用此强类型的资源类的资源查找。 | |||
| /// </summary> | |||
| [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | |||
| internal static global::System.Globalization.CultureInfo Culture | |||
| { | |||
| get | |||
| { | |||
| return resourceCulture; | |||
| } | |||
| set | |||
| { | |||
| resourceCulture = value; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,117 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <root> | |||
| <!-- | |||
| Microsoft ResX Schema | |||
| Version 2.0 | |||
| The primary goals of this format is to allow a simple XML format | |||
| that is mostly human readable. The generation and parsing of the | |||
| various data types are done through the TypeConverter classes | |||
| associated with the data types. | |||
| Example: | |||
| ... ado.net/XML headers & schema ... | |||
| <resheader name="resmimetype">text/microsoft-resx</resheader> | |||
| <resheader name="version">2.0</resheader> | |||
| <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | |||
| <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | |||
| <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | |||
| <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | |||
| <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | |||
| <value>[base64 mime encoded serialized .NET Framework object]</value> | |||
| </data> | |||
| <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||
| <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | |||
| <comment>This is a comment</comment> | |||
| </data> | |||
| There are any number of "resheader" rows that contain simple | |||
| name/value pairs. | |||
| Each data row contains a name, and value. The row also contains a | |||
| type or mimetype. Type corresponds to a .NET class that support | |||
| text/value conversion through the TypeConverter architecture. | |||
| Classes that don't support this are serialized and stored with the | |||
| mimetype set. | |||
| The mimetype is used for serialized objects, and tells the | |||
| ResXResourceReader how to depersist the object. This is currently not | |||
| extensible. For a given mimetype the value must be set accordingly: | |||
| Note - application/x-microsoft.net.object.binary.base64 is the format | |||
| that the ResXResourceWriter will generate, however the reader can | |||
| read any of the formats listed below. | |||
| mimetype: application/x-microsoft.net.object.binary.base64 | |||
| value : The object must be serialized with | |||
| : System.Serialization.Formatters.Binary.BinaryFormatter | |||
| : and then encoded with base64 encoding. | |||
| mimetype: application/x-microsoft.net.object.soap.base64 | |||
| value : The object must be serialized with | |||
| : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | |||
| : and then encoded with base64 encoding. | |||
| mimetype: application/x-microsoft.net.object.bytearray.base64 | |||
| value : The object must be serialized into a byte array | |||
| : using a System.ComponentModel.TypeConverter | |||
| : and then encoded with base64 encoding. | |||
| --> | |||
| <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | |||
| <xsd:element name="root" msdata:IsDataSet="true"> | |||
| <xsd:complexType> | |||
| <xsd:choice maxOccurs="unbounded"> | |||
| <xsd:element name="metadata"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" type="xsd:string" /> | |||
| <xsd:attribute name="type" type="xsd:string" /> | |||
| <xsd:attribute name="mimetype" type="xsd:string" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="assembly"> | |||
| <xsd:complexType> | |||
| <xsd:attribute name="alias" type="xsd:string" /> | |||
| <xsd:attribute name="name" type="xsd:string" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="data"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||
| <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> | |||
| <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | |||
| <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="resheader"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" type="xsd:string" use="required" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| </xsd:choice> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| </xsd:schema> | |||
| <resheader name="resmimetype"> | |||
| <value>text/microsoft-resx</value> | |||
| </resheader> | |||
| <resheader name="version"> | |||
| <value>2.0</value> | |||
| </resheader> | |||
| <resheader name="reader"> | |||
| <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| <resheader name="writer"> | |||
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| </root> | |||
| @ -0,0 +1,30 @@ | |||
| //------------------------------------------------------------------------------ | |||
| // <auto-generated> | |||
| // 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. | |||
| // </auto-generated> | |||
| //------------------------------------------------------------------------------ | |||
| 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; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,7 @@ | |||
| <?xml version='1.0' encoding='utf-8'?> | |||
| <SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"> | |||
| <Profiles> | |||
| <Profile Name="(Default)" /> | |||
| </Profiles> | |||
| <Settings /> | |||
| </SettingsFile> | |||