From 441e712ee2773c392726cf5039b4dc4eaf323644 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Tue, 6 Feb 2018 14:35:58 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E6=96=99=E8=B0=83=E6=95=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BO/BO/Dtos/ClientGoodsSetDto.cs | 2 +- BO/Utils/UrlUtil.cs | 32 +- .../MaterialRequisition.csproj | 12 +- .../MaterialRequisitionContext.cs | 77 +++ .../MaterialRequisitionForm.Designer.cs | 501 +++++++++--------- .../MaterialRequisitionForm.cs | 480 ++++++++++++++--- .../MaterialRequisitionForm.resx | 5 +- .../Model/MaterialRequisitionRecord.cs | 49 +- .../Model/MaterialRequisitionRecordDto.cs | 24 - .../Model/MaterialRequisitionRecordRpc.cs | 61 --- .../WeightSettingFrom.Designer.cs | 292 ++++++++++ MaterialRequisition/WeightSettingFrom.cs | 100 ++++ .../WeightSettingFrom.resx | 36 -- TrunksIousOutInStore/Test.Designer.cs | 239 --------- TrunksIousOutInStore/Test.cs | 20 - .../TrunksIousOutInStore.csproj | 13 +- .../TrunksIousOutInStoreForm.Designer.cs | 151 +++--- .../TrunksIousOutInStoreForm.cs | 20 +- 18 files changed, 1301 insertions(+), 813 deletions(-) create mode 100644 MaterialRequisition/MaterialRequisitionContext.cs delete mode 100644 MaterialRequisition/Model/MaterialRequisitionRecordDto.cs delete mode 100644 MaterialRequisition/Model/MaterialRequisitionRecordRpc.cs create mode 100644 MaterialRequisition/WeightSettingFrom.Designer.cs create mode 100644 MaterialRequisition/WeightSettingFrom.cs rename TrunksIousOutInStore/Test.resx => MaterialRequisition/WeightSettingFrom.resx (71%) delete mode 100644 TrunksIousOutInStore/Test.Designer.cs delete mode 100644 TrunksIousOutInStore/Test.cs diff --git a/BO/BO/Dtos/ClientGoodsSetDto.cs b/BO/BO/Dtos/ClientGoodsSetDto.cs index 5910a11..3e26255 100644 --- a/BO/BO/Dtos/ClientGoodsSetDto.cs +++ b/BO/BO/Dtos/ClientGoodsSetDto.cs @@ -15,7 +15,7 @@ namespace BO.BO.Dtos public string Goods_Name { get; set; } public string Goods_Code { get; set; } public string Goods_Spec { get; set; } - + public string Goods_MainUnit { get; set; } public decimal Goods_MainUnitRatio { get; set; }//主辅换算主单位比例 public decimal? StandardWeight { get; set; } diff --git a/BO/Utils/UrlUtil.cs b/BO/Utils/UrlUtil.cs index 0bc31c4..97c54b8 100644 --- a/BO/Utils/UrlUtil.cs +++ b/BO/Utils/UrlUtil.cs @@ -8,7 +8,7 @@ using System.Web; namespace BO.Utils { - public class UrlUtil + public class UrlUtil { public static string GetBarCode(string barCode) { @@ -17,13 +17,35 @@ namespace BO.Utils if (barCode.Contains("?") && barCode.ToLower().Contains("http")) { - barCode = barCode.Replace(ButcherAppContext.Context.UrlConfig.OutAddress+"?code=", ""); + barCode = barCode.Replace(ButcherAppContext.Context.UrlConfig.OutAddress + "?code=", ""); var andIndex = barCode.IndexOf("&", StringComparison.Ordinal); barCode = barCode.Substring(0, andIndex); } return barCode.Trim(); } + public static string ParseCode(string url) + { + if (url.Contains("?")) + { + var arr = url.Split(new char[] { '?' }, StringSplitOptions.RemoveEmptyEntries); + if (arr.Length > 1) + { + var list = arr[1].Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries); + foreach (var item in list) + { + var l = item.Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries); + if (l.Length == 2 && l[0].ToUpper() == "CODE") + return l[1].Trim(); + + } + return string.Empty; + } + return string.Empty; + } + return url.Trim(); + } + public static string GetGoodsName(string barCode) { @@ -33,8 +55,8 @@ namespace BO.Utils { var index = barCode.IndexOf("name=", StringComparison.Ordinal); - barCode = barCode.Substring(index+5); - var name= barCode.Trim(); + barCode = barCode.Substring(index + 5); + var name = barCode.Trim(); if (name == "qpbt") { return "去皮白条"; @@ -104,7 +126,7 @@ namespace BO.Utils } if (isEncoded) { - result[(string) MyUrlDeCode(key, encoding)] = MyUrlDeCode(value, encoding); + result[(string)MyUrlDeCode(key, encoding)] = MyUrlDeCode(value, encoding); } else { diff --git a/MaterialRequisition/MaterialRequisition.csproj b/MaterialRequisition/MaterialRequisition.csproj index 3046501..aac1d23 100644 --- a/MaterialRequisition/MaterialRequisition.csproj +++ b/MaterialRequisition/MaterialRequisition.csproj @@ -74,9 +74,7 @@ MaterialRequisitionForm.cs - - Form @@ -84,6 +82,13 @@ GoodsSetForm.cs + + + Form + + + WeightSettingFrom.cs + MaterialRequisitionForm.cs @@ -99,6 +104,9 @@ GoodsSetForm.cs + + WeightSettingFrom.cs + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/MaterialRequisition/MaterialRequisitionContext.cs b/MaterialRequisition/MaterialRequisitionContext.cs new file mode 100644 index 0000000..803d49d --- /dev/null +++ b/MaterialRequisition/MaterialRequisitionContext.cs @@ -0,0 +1,77 @@ +using System; +using System.IO; +using System.Windows.Forms; +using BO.Utils; + +namespace MaterialRequisition +{ + public static class MaterialRequisitionContext + { + private static string loginConfigPath = Application.StartupPath + "\\MaterialRequisitionConfig.xml"; + private static MaterialRequisitionConfig _config; + public static MaterialRequisitionConfig Config + { + get + { + if (_config == null) + _config = CreateConfig(); + return _config; + } + } + static MaterialRequisitionConfig CreateConfig() + { + var config = new MaterialRequisitionConfig(); + if (!File.Exists(loginConfigPath)) + { + XmlUtil.SerializerObjToFile(config, loginConfigPath); + } + else + config = XmlUtil.DeserializeFromFile(loginConfigPath); + return config; + } + + public static void Save() + { + 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(_config, loginConfigPath); + } + } + + public class MaterialRequisitionConfig + { + public string WeightSet { get; set; } + + public string ComSet { get; set; } + + public int? RateSet { get; set; } + + public int? BitSet { get; set; } + + 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; } + } +} diff --git a/MaterialRequisition/MaterialRequisitionForm.Designer.cs b/MaterialRequisition/MaterialRequisitionForm.Designer.cs index b2e6547..fca8b97 100644 --- a/MaterialRequisition/MaterialRequisitionForm.Designer.cs +++ b/MaterialRequisition/MaterialRequisitionForm.Designer.cs @@ -28,40 +28,31 @@ /// private void InitializeComponent() { + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = 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 dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.dataGridViewSubmited = new BWP.WinFormControl.UDataGridView(); - 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.groupBox1 = new System.Windows.Forms.GroupBox(); this.dataGridViewUnSubmit = 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.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.cbxBatch = new System.Windows.Forms.ComboBox(); + this.cbxStore = new System.Windows.Forms.ComboBox(); + this.lbStore = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); this.cbxWorkUnit = new System.Windows.Forms.ComboBox(); this.label5 = new System.Windows.Forms.Label(); this.cbxWorkShop = new System.Windows.Forms.ComboBox(); @@ -69,6 +60,9 @@ this.panel2 = new System.Windows.Forms.Panel(); this.lblChengZhong = new System.Windows.Forms.Label(); this.btnWeightSet = new System.Windows.Forms.Button(); + this.btnGoodsSet = new System.Windows.Forms.Button(); + this.flpGoods = new System.Windows.Forms.FlowLayoutPanel(); + this.flpClass = new System.Windows.Forms.FlowLayoutPanel(); this.panel4 = new System.Windows.Forms.Panel(); this.textBox3 = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); @@ -76,13 +70,21 @@ this.label2 = new System.Windows.Forms.Label(); this.textBox1 = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); - this.cbxBatch = new System.Windows.Forms.ComboBox(); - this.cbxStore = new System.Windows.Forms.ComboBox(); - this.lbStore = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.btnGoodsSet = new System.Windows.Forms.Button(); - this.flpGoods = new System.Windows.Forms.FlowLayoutPanel(); - this.flpClass = new System.Windows.Forms.FlowLayoutPanel(); + this.U_ID = 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.LossWeightColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -92,7 +94,6 @@ 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(); @@ -140,19 +141,19 @@ this.dataGridViewSubmited.AllowUserToDeleteRows = false; this.dataGridViewSubmited.AllowUserToResizeColumns = false; this.dataGridViewSubmited.AllowUserToResizeRows = false; - dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.dataGridViewSubmited.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7; + 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; - dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridViewSubmited.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8; + 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, @@ -160,6 +161,7 @@ this.dataGridViewTextBoxColumn3, this.dataGridViewTextBoxColumn4, this.dataGridViewTextBoxColumn5, + this.LossWeightColumn, this.dataGridViewTextBoxColumn6, this.dataGridViewTextBoxColumn7}); this.dataGridViewSubmited.Location = new System.Drawing.Point(6, 21); @@ -167,61 +169,14 @@ this.dataGridViewSubmited.Name = "dataGridViewSubmited"; this.dataGridViewSubmited.ReadOnly = true; this.dataGridViewSubmited.RowHeadersVisible = false; - dataGridViewCellStyle9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.dataGridViewSubmited.RowsDefaultCellStyle = dataGridViewCellStyle9; + dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.dataGridViewSubmited.RowsDefaultCellStyle = dataGridViewCellStyle5; 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; // - // 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; - // // groupBox1 // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -243,23 +198,23 @@ this.dataGridViewUnSubmit.AllowUserToDeleteRows = false; this.dataGridViewUnSubmit.AllowUserToResizeColumns = false; this.dataGridViewUnSubmit.AllowUserToResizeRows = false; - dataGridViewCellStyle10.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.dataGridViewUnSubmit.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle10; + dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.dataGridViewUnSubmit.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6; 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; - dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle11.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridViewUnSubmit.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; + dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridViewUnSubmit.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7; this.dataGridViewUnSubmit.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridViewUnSubmit.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.un序号, + this.U_ID, this.un条码, this.un编码, this.un名称, @@ -271,61 +226,14 @@ this.dataGridViewUnSubmit.Name = "dataGridViewUnSubmit"; this.dataGridViewUnSubmit.ReadOnly = true; this.dataGridViewUnSubmit.RowHeadersVisible = false; - dataGridViewCellStyle12.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.dataGridViewUnSubmit.RowsDefaultCellStyle = dataGridViewCellStyle12; + dataGridViewCellStyle9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.dataGridViewUnSubmit.RowsDefaultCellStyle = dataGridViewCellStyle9; 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; // - // 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; - // // btnCommit // this.btnCommit.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); @@ -335,6 +243,7 @@ this.btnCommit.TabIndex = 0; this.btnCommit.Text = "提交"; this.btnCommit.UseVisualStyleBackColor = true; + this.btnCommit.Click += new System.EventHandler(this.btnCommit_Click); // // btnDelete // @@ -345,13 +254,12 @@ this.btnDelete.TabIndex = 0; this.btnDelete.Text = "删除"; this.btnDelete.UseVisualStyleBackColor = true; + this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click); // // 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); @@ -370,16 +278,7 @@ 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; + this.btnEnableWeight.Click += new System.EventHandler(this.btnEnableWeight_Click); // // picNetStatus // @@ -391,15 +290,6 @@ 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; @@ -426,6 +316,44 @@ this.panel3.Size = new System.Drawing.Size(204, 118); this.panel3.TabIndex = 34; // + // cbxBatch + // + this.cbxBatch.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbxBatch.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.cbxBatch.FormattingEnabled = true; + this.cbxBatch.Location = new System.Drawing.Point(69, 89); + this.cbxBatch.Name = "cbxBatch"; + this.cbxBatch.Size = new System.Drawing.Size(121, 24); + this.cbxBatch.TabIndex = 46; + // + // cbxStore + // + this.cbxStore.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbxStore.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.cbxStore.FormattingEnabled = true; + this.cbxStore.Location = new System.Drawing.Point(69, 60); + this.cbxStore.Name = "cbxStore"; + this.cbxStore.Size = new System.Drawing.Size(121, 24); + this.cbxStore.TabIndex = 47; + // + // lbStore + // + this.lbStore.AutoSize = true; + this.lbStore.Location = new System.Drawing.Point(3, 96); + this.lbStore.Name = "lbStore"; + this.lbStore.Size = new System.Drawing.Size(65, 12); + this.lbStore.TabIndex = 44; + this.lbStore.Text = "批 次:"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(3, 67); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(65, 12); + this.label6.TabIndex = 45; + this.label6.Text = "仓 库:"; + // // cbxWorkUnit // this.cbxWorkUnit.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -493,6 +421,40 @@ this.btnWeightSet.TabIndex = 0; this.btnWeightSet.Text = "称设置"; this.btnWeightSet.UseVisualStyleBackColor = true; + this.btnWeightSet.Click += new System.EventHandler(this.btnWeightSet_Click); + // + // btnGoodsSet + // + this.btnGoodsSet.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnGoodsSet.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnGoodsSet.Location = new System.Drawing.Point(280, 212); + this.btnGoodsSet.Name = "btnGoodsSet"; + this.btnGoodsSet.Size = new System.Drawing.Size(62, 76); + this.btnGoodsSet.TabIndex = 37; + this.btnGoodsSet.Text = "产品设置"; + this.btnGoodsSet.UseVisualStyleBackColor = true; + this.btnGoodsSet.Click += new System.EventHandler(this.btnGoodsSet_Click); + // + // flpGoods + // + this.flpGoods.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.flpGoods.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.flpGoods.Location = new System.Drawing.Point(4, 294); + this.flpGoods.Name = "flpGoods"; + this.flpGoods.Size = new System.Drawing.Size(341, 319); + this.flpGoods.TabIndex = 36; + // + // flpClass + // + this.flpClass.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.flpClass.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.flpClass.Location = new System.Drawing.Point(3, 212); + this.flpClass.Name = "flpClass"; + this.flpClass.Size = new System.Drawing.Size(271, 76); + this.flpClass.TabIndex = 35; // // panel4 // @@ -546,7 +508,6 @@ // // 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"; @@ -562,76 +523,126 @@ this.label1.TabIndex = 0; this.label1.Text = "条码"; // - // cbxBatch + // U_ID // - this.cbxBatch.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbxBatch.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.cbxBatch.FormattingEnabled = true; - this.cbxBatch.Location = new System.Drawing.Point(69, 89); - this.cbxBatch.Name = "cbxBatch"; - this.cbxBatch.Size = new System.Drawing.Size(121, 24); - this.cbxBatch.TabIndex = 46; + this.U_ID.DataPropertyName = "ID"; + this.U_ID.HeaderText = "序号"; + this.U_ID.Name = "U_ID"; + this.U_ID.ReadOnly = true; + this.U_ID.Width = 80; // - // cbxStore + // un条码 // - this.cbxStore.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbxStore.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.cbxStore.FormattingEnabled = true; - this.cbxStore.Location = new System.Drawing.Point(69, 60); - this.cbxStore.Name = "cbxStore"; - this.cbxStore.Size = new System.Drawing.Size(121, 24); - this.cbxStore.TabIndex = 47; + this.un条码.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.un条码.DataPropertyName = "BarCode"; + this.un条码.HeaderText = "条码"; + this.un条码.Name = "un条码"; + this.un条码.ReadOnly = true; + this.un条码.Width = 65; // - // lbStore + // un编码 // - this.lbStore.AutoSize = true; - this.lbStore.Location = new System.Drawing.Point(3, 96); - this.lbStore.Name = "lbStore"; - this.lbStore.Size = new System.Drawing.Size(65, 12); - this.lbStore.TabIndex = 44; - this.lbStore.Text = "批 次:"; + this.un编码.DataPropertyName = "Goods_Code"; + this.un编码.HeaderText = "编码"; + this.un编码.Name = "un编码"; + this.un编码.ReadOnly = true; // - // label6 + // un名称 // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(3, 67); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(65, 12); - this.label6.TabIndex = 45; - this.label6.Text = "仓 库:"; + this.un名称.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.un名称.DataPropertyName = "Goods_Name"; + this.un名称.HeaderText = "名称"; + this.un名称.Name = "un名称"; + this.un名称.ReadOnly = true; + this.un名称.Width = 65; // - // btnGoodsSet + // un重量 // - this.btnGoodsSet.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnGoodsSet.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnGoodsSet.Location = new System.Drawing.Point(280, 212); - this.btnGoodsSet.Name = "btnGoodsSet"; - this.btnGoodsSet.Size = new System.Drawing.Size(62, 76); - this.btnGoodsSet.TabIndex = 37; - this.btnGoodsSet.Text = "产品设置"; - this.btnGoodsSet.UseVisualStyleBackColor = true; - this.btnGoodsSet.Click += new System.EventHandler(this.btnGoodsSet_Click); + this.un重量.DataPropertyName = "Weight"; + dataGridViewCellStyle8.Format = "#0.######"; + this.un重量.DefaultCellStyle = dataGridViewCellStyle8; + this.un重量.HeaderText = "重量"; + this.un重量.Name = "un重量"; + this.un重量.ReadOnly = true; // - // flpGoods + // un单位 // - this.flpGoods.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.flpGoods.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.flpGoods.Location = new System.Drawing.Point(4, 294); - this.flpGoods.Name = "flpGoods"; - this.flpGoods.Size = new System.Drawing.Size(341, 319); - this.flpGoods.TabIndex = 36; + this.un单位.DataPropertyName = "Goods_MainUnit"; + this.un单位.HeaderText = "单位"; + this.un单位.Name = "un单位"; + this.un单位.ReadOnly = true; // - // flpClass + // un数量 // - this.flpClass.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.flpClass.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.flpClass.Location = new System.Drawing.Point(3, 212); - this.flpClass.Name = "flpClass"; - this.flpClass.Size = new System.Drawing.Size(271, 76); - this.flpClass.TabIndex = 35; + this.un数量.DataPropertyName = "Number"; + this.un数量.HeaderText = "数量"; + this.un数量.Name = "un数量"; + this.un数量.ReadOnly = true; + // + // dataGridViewTextBoxColumn1 + // + this.dataGridViewTextBoxColumn1.DataPropertyName = "ID"; + 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.DataPropertyName = "BarCode"; + this.dataGridViewTextBoxColumn2.HeaderText = "条码"; + this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2"; + this.dataGridViewTextBoxColumn2.ReadOnly = true; + this.dataGridViewTextBoxColumn2.Width = 65; + // + // dataGridViewTextBoxColumn3 + // + this.dataGridViewTextBoxColumn3.DataPropertyName = "Goods_Code"; + this.dataGridViewTextBoxColumn3.HeaderText = "编码"; + this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3"; + this.dataGridViewTextBoxColumn3.ReadOnly = true; + // + // dataGridViewTextBoxColumn4 + // + this.dataGridViewTextBoxColumn4.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.dataGridViewTextBoxColumn4.DataPropertyName = "Goods_Name"; + this.dataGridViewTextBoxColumn4.HeaderText = "名称"; + this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4"; + this.dataGridViewTextBoxColumn4.ReadOnly = true; + this.dataGridViewTextBoxColumn4.Width = 65; + // + // dataGridViewTextBoxColumn5 + // + this.dataGridViewTextBoxColumn5.DataPropertyName = "Weight"; + dataGridViewCellStyle3.Format = "#0.######"; + this.dataGridViewTextBoxColumn5.DefaultCellStyle = dataGridViewCellStyle3; + this.dataGridViewTextBoxColumn5.HeaderText = "重量"; + this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5"; + this.dataGridViewTextBoxColumn5.ReadOnly = true; + // + // LossWeightColumn + // + this.LossWeightColumn.DataPropertyName = "LossWeight"; + dataGridViewCellStyle4.Format = "#0.######"; + this.LossWeightColumn.DefaultCellStyle = dataGridViewCellStyle4; + this.LossWeightColumn.HeaderText = "损耗"; + this.LossWeightColumn.Name = "LossWeightColumn"; + this.LossWeightColumn.ReadOnly = true; + // + // dataGridViewTextBoxColumn6 + // + this.dataGridViewTextBoxColumn6.DataPropertyName = "Goods_MainUnit"; + this.dataGridViewTextBoxColumn6.HeaderText = "单位"; + this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6"; + this.dataGridViewTextBoxColumn6.ReadOnly = true; + // + // dataGridViewTextBoxColumn7 + // + this.dataGridViewTextBoxColumn7.DataPropertyName = "Number"; + this.dataGridViewTextBoxColumn7.HeaderText = "数量"; + this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7"; + this.dataGridViewTextBoxColumn7.ReadOnly = true; // // MaterialRequisitionForm // @@ -639,11 +650,13 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1131, 625); this.Controls.Add(this.splitContainer1); + this.KeyPreview = true; this.MinimizeBox = false; this.Name = "MaterialRequisitionForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "领料退料"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; + this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.MaterialRequisitionForm_KeyPress); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); @@ -654,7 +667,6 @@ ((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(); @@ -672,9 +684,7 @@ 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; @@ -690,20 +700,6 @@ 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; @@ -718,6 +714,21 @@ private System.Windows.Forms.Button btnGoodsSet; private System.Windows.Forms.FlowLayoutPanel flpGoods; private System.Windows.Forms.FlowLayoutPanel flpClass; + 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 LossWeightColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn6; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn7; + private System.Windows.Forms.DataGridViewTextBoxColumn U_ID; + 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数量; } } diff --git a/MaterialRequisition/MaterialRequisitionForm.cs b/MaterialRequisition/MaterialRequisitionForm.cs index ac9d54c..3876831 100644 --- a/MaterialRequisition/MaterialRequisitionForm.cs +++ b/MaterialRequisition/MaterialRequisitionForm.cs @@ -21,7 +21,7 @@ using Newtonsoft.Json; namespace MaterialRequisition { - public partial class MaterialRequisitionForm : Form,IAfterLogin + public partial class MaterialRequisitionForm : Form, IAfterLogin { public string RoleName { get { return "领料退料"; } } @@ -31,6 +31,7 @@ namespace MaterialRequisition } private List mSetList; private readonly string mDropDownSetsFileName = "MaterialRequisition_DropDownSets.xml"; + private readonly string BaseRpcUrl = "/MainSystem/B3ClientService/Rpcs/BillRpc/MaterialRequisitionRecordRpc/"; private DropDownSets mDropDownSets; #region weightNeed SerialPort weightPort; @@ -40,9 +41,8 @@ namespace MaterialRequisition readonly StringBuilder _dataStrBuilder = new StringBuilder(); #endregion - private readonly Thread _tdSyncLocalToMiddleDb; + private Thread tdSyncSubmited; private readonly Thread _tcCheckNetStatus; - private readonly Thread _tcCheckSyncStatus; public MaterialRequisitionForm() { InitializeComponent(); @@ -53,59 +53,23 @@ namespace MaterialRequisition { if (_inQueryThread != null && _inQueryThread.IsAlive) { - //DisableWeight(); - } - if (_tdSyncLocalToMiddleDb != null && _tdSyncLocalToMiddleDb.IsAlive) - { - _tdSyncLocalToMiddleDb.Abort(); + DisableWeight(); } + if (tdSyncSubmited != null && tdSyncSubmited.IsAlive) + tdSyncSubmited.Abort(); if (_tcCheckNetStatus != null && _tcCheckNetStatus.IsAlive) { _tcCheckNetStatus.Abort(); } - if (_tcCheckSyncStatus != null && _tcCheckSyncStatus.IsAlive) - { - _tcCheckSyncStatus.Abort(); - } }; InitCombox(); InitControl(); - _tdSyncLocalToMiddleDb = new Thread(SyncLocalToMiddleDb); - _tdSyncLocalToMiddleDb.Start(); - + BindUnSubmitGrid(); + tdSyncSubmited = new Thread(SyncSubmited); + tdSyncSubmited.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; @@ -151,23 +115,6 @@ namespace MaterialRequisition } } - private void SyncLocalToMiddleDb() - { - while (true) - { - if (laseConnection) - { - this.BeginInvoke(new Action(() => - { - MaterialRequisitionRecordRpc.GetInstance().SyncToServer(); - })); - - } - Thread.Sleep(1000); - } - } - - private void InitCombox() { if (LoginRpcUtil.TestConnection(500)) @@ -204,9 +151,9 @@ namespace MaterialRequisition var batch = mDropDownSets.Details.FirstOrDefault(x => x.Name == DropDownSets.批次); if (batch != null) { - cbxStore.DataSource = batch.Details; - cbxStore.DisplayMember = "Name"; - cbxStore.ValueMember = "ID"; + cbxBatch.DataSource = batch.Details; + cbxBatch.DisplayMember = "Name"; + cbxBatch.ValueMember = "ID"; } } @@ -272,6 +219,60 @@ namespace MaterialRequisition return set; } + + BindingList unSubmitList = new BindingList(); + BindingList submitedList = new BindingList(); + + void BindUnSubmitGrid() + { + var json = RpcFacade.Call(BaseRpcUrl + "GetUnSubmitList"); + var list = JsonConvert.DeserializeObject>(json); + foreach (MaterialRequisitionRecord record in list) + { + unSubmitList.Add(record); + } + dataGridViewUnSubmit.DataSource = unSubmitList; + dataGridViewUnSubmit.Refresh(); + } + void SyncSubmited() + { + while (true) + { + var json = RpcFacade.Call(BaseRpcUrl + "GetSubmitedList"); + var list = JsonConvert.DeserializeObject>(json); + + if (this.IsHandleCreated) + { + this.Invoke(new Action(() => + { + if (list.Count > 0) + { + submitedList.Clear(); + foreach (MaterialRequisitionRecord record in list) + { + submitedList.Add(record); + } + } + BindSubmitedGrid(); + })); + + } + + Thread.Sleep(2000); + } + } + + void BindSubmitedGrid() + { + if (dataGridViewSubmited.DataSource == null) + { + dataGridViewSubmited.DataSource = submitedList; + } + else + { + dataGridViewSubmited.Refresh(); + } + } private void btnGoodsSet_Click(object sender, EventArgs e) { var f = new GoodsSetForm(); @@ -336,11 +337,358 @@ namespace MaterialRequisition btn.Text = set.Goods_Name; btn.Tag = set; btn.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - //btn.Click += BtnGoods_Click; + btn.Click += BtnGoods_Click; btn.BackColor = SystemColors.Control; btn.Width = 140; btn.Height = 80; return btn; } + + private void BtnGoods_Click(object sender, EventArgs e) + { + if (cbxStore.SelectedValue == null) + throw new Exception("请选择领用仓库"); + if (cbxWorkUnit.SelectedValue == null) + throw new Exception("请选择工作单元"); + if (cbxBatch.SelectedValue == null) + throw new Exception("请选择生产批次"); + var btn = sender as Button; + var tag = btn.Tag as MaterialRequisitionGoodsSet; + var record = new MaterialRequisitionRecord(); + record.Goods_ID = tag.Goods_ID; + InsertToServer(record); + } + + bool end = false; + private void MaterialRequisitionForm_KeyPress(object sender, KeyPressEventArgs e) + { + if (cbxStore.SelectedValue == null) + throw new Exception("请选择领用仓库"); + if (cbxWorkUnit.SelectedValue == null) + throw new Exception("请选择工作单元"); + if (cbxBatch.SelectedValue == null) + throw new Exception("请选择生产批次"); + if (end) + { + textBox1.Text = string.Empty; + end = false; + } + if (!textBox1.Focused) + { + textBox1.Focus(); + textBox1.Text = e.KeyChar.ToString(); + textBox1.Select(textBox1.TextLength, 0); + } + if (e.KeyChar == (char)Keys.Enter) + { + e.Handled = true; + var code = UrlUtil.ParseCode(textBox1.Text); + textBox1.Text = code; + textBox1.Select(textBox1.TextLength, 0); + end = true; + if (string.IsNullOrEmpty(code)) + return; + var json = RpcFacade.Call(BaseRpcUrl + "GetCodeStoreInfo", code); + if (string.IsNullOrEmpty(json)) + throw new Exception("扫码无效或已被领用"); + var re = JsonConvert.DeserializeObject(json); + if (re.Store_ID != Convert.ToInt64(cbxStore.SelectedValue)) + throw new Exception("所选仓库与存货所在库不一致"); + + textBox2.Text = re.Goods_Name; + textBox3.Text = (re.Weight ?? 0).ToString("#0.######"); + + var record = new MaterialRequisitionRecord(); + record.BarCode = code; + record.Goods_ID = re.Goods_ID; + record.BeforeWeight = re.BeforeWeight; + InsertToServer(record); + } + } + + void InsertToServer(MaterialRequisitionRecord record) + { + record.ID = 0; + record.Creator = ButcherAppContext.Context.UserConfig.UserName; + if (cbxWorkShop.SelectedValue != null) + record.WorkShop_ID = Convert.ToInt64(cbxWorkShop.SelectedValue); + record.WorkUnit_ID = Convert.ToInt64(cbxWorkUnit.SelectedValue); + record.Store_ID = Convert.ToInt64(cbxStore.SelectedValue); + record.ProductBatch_ID = Convert.ToInt64(cbxBatch.SelectedValue); + record.ProductBatch = cbxBatch.SelectedText; + var json = RpcFacade.Call(BaseRpcUrl + "Insert", JsonConvert.SerializeObject(record)); + unSubmitList.Insert(0, JsonConvert.DeserializeObject(json)); + dataGridViewUnSubmit.Refresh(); + } + + #region weightNeed + void OpenSerialPort() + { + if (!_enableWeight) + return; + if (MaterialRequisitionContext.Config.RateSet == null) + throw new Exception("请先配置称相关信息"); + + weightPort.PortName = MaterialRequisitionContext.Config.ComSet; + weightPort.BaudRate = MaterialRequisitionContext.Config.RateSet.Value; + weightPort.DataBits = MaterialRequisitionContext.Config.BitSet.Value; + weightPort.ReadBufferSize = 4096 * 100; + if (!string.IsNullOrEmpty(MaterialRequisitionContext.Config.Format)) + format = "{0:{format}}".Replace("{format}", MaterialRequisitionContext.Config.Format); + + switch (MaterialRequisitionContext.Config.WeightSet) + { + case "IND560": + _dataFormat = new IND560DataFormat(); + break; + case "Xk3124": + _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) + { + 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 (MaterialRequisitionContext.Config.WeightType == 0) + { + if (string.IsNullOrEmpty(str)) + str = "0"; + this.Invoke(new Action(delegate() + { + lblChengZhong.Text = string.Format(format, decimal.Parse(str)); + if (str != "0") + { + //AddWeightDetail(decimal.Parse(lblChengZhong.Text)); + doInsertUnSubmit(decimal.Parse(lblChengZhong.Text)); + } + })); + } + else + { + decimal num = 0; + if (decimal.TryParse(str, out num)) + { + this.Invoke(new Action(delegate() + { + lblChengZhong.Text = string.Format(format, num); + })); + // LocalGradeAndWeightBL.SaveWeightData(num); + WeighAvgControl.Add(num, isStatic); + } + if (WeighAvgControl.TryGetValue(out num)) + { + this.Invoke(new Action(delegate() + { + //lblChengZhong.Text = string.Format(format, num); + if (str != "0") + { + doInsertUnSubmit(decimal.Parse(string.Format(format, num))); + //AddWeightDetail(decimal.Parse(string.Format(format, num))); + } + })); + } + } + } + _dataStrBuilder.Clear(); + } + else if (_dataStrBuilder.Length != 0) + { + _dataStrBuilder.Append(c); + } + } + } + } + + static object _obj = new object(); + private void doInsertUnSubmit(decimal weight) + { + lock (_obj) + { + //称重 + //找到称重为空条码不为空的 + var fd = unSubmitList.LastOrDefault(x => x.Weight == null); + if (fd == null) + { + //todo 记录一个异常 + // record.ID = unSumbitList.Max(x => x.ID) + 1; + // unSumbitList.Add(record); + } + else + { + RpcFacade.Call(BaseRpcUrl + "FillWeight", fd.ID, weight); + fd.Weight = weight; + dataGridViewUnSubmit.Refresh(); + } + } + } + + + private class WeighAvgControl + { + public static bool TryGetValue(out decimal result) + { + List> list; + if (mWeighList.TryDequeue(out list)) + { + var r = list.Where(x => x.Item2).Select(x => x.Item1).GroupBy(x => x); + var firstOrDefault = r.OrderByDescending(x => x.Count()).FirstOrDefault(); + if (firstOrDefault != null) + { + result = firstOrDefault.Key; + return true; + } + result = 0; + return false; + } + result = 0; + return false; + } + + static ConcurrentQueue>> mWeighList = new ConcurrentQueue>>(); + + static List> _list = new List>(); + + public static void Add(decimal value, bool isStatic) + { + if (value >= MaterialRequisitionContext.Config.MinWeight && value <= MaterialRequisitionContext.Config.MaxWeight) + { + _list.Add(new Tuple(value, isStatic)); + } + else + { + if (_list.Count > 0) + { + mWeighList.Enqueue(_list); + _list = new List>(); + } + } + } + } + + void DisableWeight() + { + _mainProcessIsRun = false; + lblChengZhong.Text = string.Format(format, 0); + format = "{0:0.00}"; + Thread.Sleep(10); + if (_inQueryThread.IsAlive) + { + _inQueryThread.Abort(); + } + if (weightPort.IsOpen) + weightPort.Close(); + } + + #endregion + + private bool _enableWeight = false; + private void btnEnableWeight_Click(object sender, EventArgs e) + { + _enableWeight = !_enableWeight; + if (_enableWeight) + { + btnEnableWeight.Text = "停止称重"; + btnEnableWeight.BackColor = Color.ForestGreen; + + OpenSerialPort(); + _mainProcessIsRun = true; + ReadData(); + + } + else + { + btnEnableWeight.Text = "开始称重"; + btnEnableWeight.BackColor = SystemColors.Control; + btnEnableWeight.UseVisualStyleBackColor = true; + + DisableWeight(); + } + } + + private void btnWeightSet_Click(object sender, EventArgs e) + { + new WeightSettingFrom().ShowDialog(); + } + + private void btnCommit_Click(object sender, EventArgs e) + { + var ids = unSubmitList.Where(x => x.Weight.HasValue).Select(x => x.ID).ToList(); + if (ids.Count == 0) + return; + RpcFacade.Call(BaseRpcUrl + "Submit", ids); + foreach (var id in ids) + { + var first = unSubmitList.First(x => x.ID == id); + unSubmitList.Remove(first); + } + dataGridViewUnSubmit.Refresh(); + } + + private void btnDelete_Click(object sender, EventArgs e) + { + if (dataGridViewUnSubmit.CurrentRow == null) + return; + var id = (long)dataGridViewUnSubmit.CurrentRow.Cells["U_ID"].Value; + RpcFacade.Call(BaseRpcUrl + "Delete", id); + var first = unSubmitList.First(x => x.ID == id); + unSubmitList.Remove(first); + dataGridViewUnSubmit.Refresh(); + } } } diff --git a/MaterialRequisition/MaterialRequisitionForm.resx b/MaterialRequisition/MaterialRequisitionForm.resx index 8197078..b1437dd 100644 --- a/MaterialRequisition/MaterialRequisitionForm.resx +++ b/MaterialRequisition/MaterialRequisitionForm.resx @@ -132,13 +132,16 @@ True + + True + True True - + True diff --git a/MaterialRequisition/Model/MaterialRequisitionRecord.cs b/MaterialRequisition/Model/MaterialRequisitionRecord.cs index aabc604..3d1b95e 100644 --- a/MaterialRequisition/Model/MaterialRequisitionRecord.cs +++ b/MaterialRequisition/Model/MaterialRequisitionRecord.cs @@ -12,30 +12,43 @@ using Newtonsoft.Json; namespace MaterialRequisition.Model { [Serializable] - [MapToTable("MaterialRequisitionRecord")] - public class MaterialRequisitionRecord : LocalSyncBase + public class MaterialRequisitionRecord { - [NonDmoProperty] - public int Index { get; set; } + public string BarCode { get; set; } + + public long? Goods_ID { 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() + public string Goods_Code { get; set; } + + public string Goods_MainUnit { get; set; } + + public long? ID { get; set; } + + private int mNumber = 1; + public int Number { - var config = new MapperConfiguration(cfg => { - cfg.CreateMap(); - }); - var mapper = config.CreateMapper(); - var dto = mapper.Map(this); - dto.Client_ID = this.ID; - return JsonConvert.SerializeObject(dto); + get { return mNumber; } + set { mNumber = value; } } + public decimal? Weight { get; set; } + + public decimal? BeforeWeight { get; set; } + + public decimal? LossWeight { get { if (BeforeWeight == null) return null; return BeforeWeight - (Weight ?? 0); } } + + public long? WorkShop_ID { get; set; } + + public long? WorkUnit_ID { get; set; } + + public long? Store_ID { get; set; } + + public long? ProductBatch_ID { get; set; } + + public string ProductBatch { get; set; } + + public string Creator { get; set; } } } diff --git a/MaterialRequisition/Model/MaterialRequisitionRecordDto.cs b/MaterialRequisition/Model/MaterialRequisitionRecordDto.cs deleted file mode 100644 index 77de943..0000000 --- a/MaterialRequisition/Model/MaterialRequisitionRecordDto.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using BO.BO.Dtos; -using Forks.EnterpriseServices.DataForm; - -namespace MaterialRequisition.Model -{ - - [DFClass] - public class MaterialRequisitionRecordDto : SyncBaseDto - { - public string BarCode { get; set; } //条码 - public long Goods_ID { get; set; } - public string Goods_Name { get; set; } - public string Goods_Spec { get; set; } - public decimal Weight { get; set; } //皮重 - public string CardBarCode { get; set; } //放产品的车的条码 - public string BiaoShi { get; set; } - - } -} \ No newline at end of file diff --git a/MaterialRequisition/Model/MaterialRequisitionRecordRpc.cs b/MaterialRequisition/Model/MaterialRequisitionRecordRpc.cs deleted file mode 100644 index 0bff7ff..0000000 --- a/MaterialRequisition/Model/MaterialRequisitionRecordRpc.cs +++ /dev/null @@ -1,61 +0,0 @@ -using BO; - -namespace MaterialRequisition.Model -{ - - public class MaterialRequisitionRecordRpc : SyncToServerBase - { - // 定义一个静态变量来保存类的实例 - private static MaterialRequisitionRecordRpc uniqueInstance; - - // 定义一个标识确保线程同步 - private static readonly object locker = new object(); - - // 定义私有构造函数,使外界不能创建该类实例 - private MaterialRequisitionRecordRpc() - { - } - - /// - /// 定义公有方法提供一个全局访问点,同时你也可以定义公有属性来提供全局访问点 - /// - /// - public static MaterialRequisitionRecordRpc GetInstance() - { - // 当第一个线程运行到这里时,此时会对locker对象 "加锁", - // 当第二个线程运行该方法时,首先检测到locker对象为"加锁"状态,该线程就会挂起等待第一个线程解锁 - // lock语句运行完之后(即线程运行完之后)会对该对象"解锁" - // 双重锁定只需要一句判断就可以了 - if (uniqueInstance == null) - { - lock (locker) - { - // 如果类的实例不存在则创建,否则直接返回 - if (uniqueInstance == null) - { - uniqueInstance = new MaterialRequisitionRecordRpc(); - } - } - } - return uniqueInstance; - } - - - protected override string InsertRpcUrl - { - get { return "/MainSystem/B3ClientService/Rpcs/BillRpc/MaterialRequisitionRecordRpc/Insert"; } - } - - protected override string UpdateRpcUrl - { - get { return "/MainSystem/B3ClientService/Rpcs/BillRpc/MaterialRequisitionRecordRpc/Update"; } - } - - protected override string DeleteRpcUrl - { - get { return "/MainSystem/B3ClientService/Rpcs/BillRpc/MaterialRequisitionRecordRpc/Delete"; } - } - - - } -} diff --git a/MaterialRequisition/WeightSettingFrom.Designer.cs b/MaterialRequisition/WeightSettingFrom.Designer.cs new file mode 100644 index 0000000..c51869f --- /dev/null +++ b/MaterialRequisition/WeightSettingFrom.Designer.cs @@ -0,0 +1,292 @@ +namespace MaterialRequisition +{ + partial class WeightSettingFrom + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.maxInput = new BWP.WinFormControl.UTextBoxWithPad(); + this.minInput = new BWP.WinFormControl.UTextBoxWithPad(); + this.label8 = new System.Windows.Forms.Label(); + this.weightReadType = new System.Windows.Forms.ComboBox(); + this.label7 = new System.Windows.Forms.Label(); + this.discont = new BWP.WinFormControl.UTextBoxWithPad(); + this.format = new BWP.WinFormControl.UTextBoxWithPad(); + this.label6 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.closeBtn = new System.Windows.Forms.Button(); + 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(255, 364); + this.maxInput.Name = "maxInput"; + this.maxInput.Size = new System.Drawing.Size(55, 26); + this.maxInput.TabIndex = 48; + this.maxInput.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Number; + // + // minInput + // + this.minInput.Font = new System.Drawing.Font("宋体", 12F); + this.minInput.Location = new System.Drawing.Point(189, 364); + this.minInput.Name = "minInput"; + this.minInput.Size = new System.Drawing.Size(55, 26); + this.minInput.TabIndex = 47; + 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(67, 364); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(109, 20); + this.label8.TabIndex = 46; + this.label8.Text = "有效区间:"; + // + // weightReadType + // + this.weightReadType.Font = new System.Drawing.Font("宋体", 15F); + this.weightReadType.FormattingEnabled = true; + this.weightReadType.Location = new System.Drawing.Point(189, 317); + this.weightReadType.Name = "weightReadType"; + this.weightReadType.Size = new System.Drawing.Size(121, 28); + this.weightReadType.TabIndex = 45; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("宋体", 15F); + this.label7.Location = new System.Drawing.Point(67, 320); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(109, 20); + this.label7.TabIndex = 44; + this.label7.Text = "读取方式:"; + // + // discont + // + this.discont.Font = new System.Drawing.Font("宋体", 14F); + this.discont.Location = new System.Drawing.Point(189, 268); + this.discont.Name = "discont"; + this.discont.Size = new System.Drawing.Size(121, 29); + this.discont.TabIndex = 43; + this.discont.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Number; + // + // format + // + this.format.Font = new System.Drawing.Font("宋体", 14F); + this.format.Location = new System.Drawing.Point(189, 220); + this.format.Name = "format"; + this.format.Size = new System.Drawing.Size(121, 29); + this.format.TabIndex = 42; + 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(67, 277); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(69, 20); + this.label6.TabIndex = 41; + this.label6.Text = "扣重:"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("宋体", 15F); + this.label5.Location = new System.Drawing.Point(67, 226); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(109, 20); + this.label5.TabIndex = 40; + this.label5.Text = "显示格式:"; + // + // closeBtn + // + this.closeBtn.Font = new System.Drawing.Font("宋体", 15F); + this.closeBtn.Location = new System.Drawing.Point(205, 410); + this.closeBtn.Name = "closeBtn"; + this.closeBtn.Size = new System.Drawing.Size(75, 35); + this.closeBtn.TabIndex = 39; + this.closeBtn.Text = "关闭"; + this.closeBtn.UseVisualStyleBackColor = true; + this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click); + // + // saveBtn + // + this.saveBtn.Font = new System.Drawing.Font("宋体", 15F); + this.saveBtn.Location = new System.Drawing.Point(99, 410); + this.saveBtn.Name = "saveBtn"; + this.saveBtn.Size = new System.Drawing.Size(75, 35); + this.saveBtn.TabIndex = 38; + 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(189, 173); + this.bitSet.Name = "bitSet"; + this.bitSet.Size = new System.Drawing.Size(121, 28); + this.bitSet.TabIndex = 35; + // + // rateSet + // + this.rateSet.Font = new System.Drawing.Font("宋体", 15F); + this.rateSet.FormattingEnabled = true; + this.rateSet.Location = new System.Drawing.Point(189, 121); + this.rateSet.Name = "rateSet"; + this.rateSet.Size = new System.Drawing.Size(121, 28); + this.rateSet.TabIndex = 36; + // + // comSet + // + this.comSet.Font = new System.Drawing.Font("宋体", 15F); + this.comSet.FormattingEnabled = true; + this.comSet.Location = new System.Drawing.Point(189, 71); + this.comSet.Name = "comSet"; + this.comSet.Size = new System.Drawing.Size(121, 28); + this.comSet.TabIndex = 37; + // + // weightSet + // + this.weightSet.Font = new System.Drawing.Font("宋体", 15F); + this.weightSet.FormattingEnabled = true; + this.weightSet.Location = new System.Drawing.Point(189, 23); + this.weightSet.Name = "weightSet"; + this.weightSet.Size = new System.Drawing.Size(121, 28); + this.weightSet.TabIndex = 34; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("宋体", 15F); + this.label4.Location = new System.Drawing.Point(67, 176); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(89, 20); + this.label4.TabIndex = 33; + this.label4.Text = "数据位:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("宋体", 15F); + this.label3.Location = new System.Drawing.Point(67, 124); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(89, 20); + this.label3.TabIndex = 32; + this.label3.Text = "波特率:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("宋体", 15F); + this.label2.Location = new System.Drawing.Point(67, 74); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(89, 20); + this.label2.TabIndex = 31; + this.label2.Text = "端口号:"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 15F); + this.label1.Location = new System.Drawing.Point(67, 26); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(89, 20); + this.label1.TabIndex = 30; + this.label1.Text = "称型号:"; + // + // WeightSettingFrom + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(391, 481); + 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.closeBtn); + 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 = "WeightSettingFrom"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "称设置"; + this.Load += new System.EventHandler(this.WeightSettingFrom_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private BWP.WinFormControl.UTextBoxWithPad maxInput; + private BWP.WinFormControl.UTextBoxWithPad minInput; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.ComboBox weightReadType; + private System.Windows.Forms.Label label7; + private BWP.WinFormControl.UTextBoxWithPad discont; + private BWP.WinFormControl.UTextBoxWithPad format; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Button closeBtn; + private System.Windows.Forms.Button saveBtn; + private System.Windows.Forms.ComboBox bitSet; + private System.Windows.Forms.ComboBox rateSet; + private System.Windows.Forms.ComboBox comSet; + private System.Windows.Forms.ComboBox weightSet; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + } +} \ No newline at end of file diff --git a/MaterialRequisition/WeightSettingFrom.cs b/MaterialRequisition/WeightSettingFrom.cs new file mode 100644 index 0000000..7b43fce --- /dev/null +++ b/MaterialRequisition/WeightSettingFrom.cs @@ -0,0 +1,100 @@ +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 MaterialRequisition +{ + public partial class WeightSettingFrom : Form + { + List weight = new List { "IND560", "Xk3124", "Xk3190A9", "Xk3190D10" }; + List com = new List { "COM1", "COM2", "COM3", "COM4", "COM5" }; + List rate = new List { "4800", "7200", "9600" }; + List bit = new List { "5", "6", "7", "8" }; + List weightRead = new List { "稳定读取", "连续发送" }; + public WeightSettingFrom() + { + InitializeComponent(); + weightSet.DataSource = weight; + comSet.DataSource = com; + rateSet.DataSource = rate; + bitSet.DataSource = bit; + weightReadType.DataSource = weightRead; + if (!string.IsNullOrEmpty(MaterialRequisitionContext.Config.WeightSet)) + weightSet.SelectedIndex = weight.IndexOf(MaterialRequisitionContext.Config.WeightSet); + else + weightSet.SelectedIndex = 0; + if (!string.IsNullOrEmpty(MaterialRequisitionContext.Config.ComSet)) + comSet.SelectedIndex = com.IndexOf(MaterialRequisitionContext.Config.ComSet); + else + comSet.SelectedIndex = 0; + if (MaterialRequisitionContext.Config.RateSet.HasValue) + rateSet.SelectedIndex = rate.IndexOf(MaterialRequisitionContext.Config.RateSet.ToString()); + else + rateSet.SelectedIndex = 2; + if (MaterialRequisitionContext.Config.BitSet.HasValue) + bitSet.SelectedIndex = bit.IndexOf(MaterialRequisitionContext.Config.BitSet.ToString()); + else + bitSet.SelectedIndex = 3; + if (string.IsNullOrEmpty(MaterialRequisitionContext.Config.Format)) + format.Text = "0.00"; + else + format.Text = MaterialRequisitionContext.Config.Format; + if (MaterialRequisitionContext.Config.Discont == null) + discont.Text = "0.00"; + else + discont.Text = MaterialRequisitionContext.Config.Discont.ToString(); + weightReadType.SelectedIndex = MaterialRequisitionContext.Config.WeightType; + minInput.Text = MaterialRequisitionContext.Config.MinWeight.ToString(); + maxInput.Text = MaterialRequisitionContext.Config.MaxWeight.ToString(); + } + + private void saveBtn_Click(object sender, EventArgs e) + { + MaterialRequisitionContext.Config.WeightSet = weight[this.weightSet.SelectedIndex]; + MaterialRequisitionContext.Config.ComSet = com[this.comSet.SelectedIndex]; + MaterialRequisitionContext.Config.RateSet = int.Parse(rate[this.rateSet.SelectedIndex]); + MaterialRequisitionContext.Config.BitSet = int.Parse(bit[this.bitSet.SelectedIndex]); + MaterialRequisitionContext.Config.Format = format.Text; + MaterialRequisitionContext.Config.WeightType = weightReadType.SelectedIndex; + if (MaterialRequisitionContext.Config.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("连续发送时 必须输入有效区间"); + MaterialRequisitionContext.Config.MinWeight = min; + MaterialRequisitionContext.Config.MaxWeight = max; + } + if (!string.IsNullOrEmpty(discont.Text)) + { + decimal v; + if (decimal.TryParse(discont.Text, out v)) + MaterialRequisitionContext.Config.Discont = v; + else + throw new Exception("扣重格式输入不正确"); + } + else + MaterialRequisitionContext.Config.Discont = 0; + MaterialRequisitionContext.Save(); + MessageBox.Show("保存成功!"); + } + + private void closeBtn_Click(object sender, EventArgs e) + { + Close(); + } + + private void WeightSettingFrom_Load(object sender, EventArgs e) + { + + } + } +} diff --git a/TrunksIousOutInStore/Test.resx b/MaterialRequisition/WeightSettingFrom.resx similarity index 71% rename from TrunksIousOutInStore/Test.resx rename to MaterialRequisition/WeightSettingFrom.resx index c06b155..1af7de1 100644 --- a/TrunksIousOutInStore/Test.resx +++ b/MaterialRequisition/WeightSettingFrom.resx @@ -117,40 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - \ No newline at end of file diff --git a/TrunksIousOutInStore/Test.Designer.cs b/TrunksIousOutInStore/Test.Designer.cs deleted file mode 100644 index 31360f2..0000000 --- a/TrunksIousOutInStore/Test.Designer.cs +++ /dev/null @@ -1,239 +0,0 @@ -namespace TrunksIousOutInStore -{ - partial class Test - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - 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 dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); - this.gridUnCheck = new BWP.WinFormControl.UDataGridView(); - this.uncheck序号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.uncheck条码 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.uncheck产品名称 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.uncheck规格 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.uncheck数量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.uncheck重量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.gridChecked = new BWP.WinFormControl.UDataGridView(); - this.序号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.条码 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.产品名称 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.规格 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.数量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.重量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - ((System.ComponentModel.ISupportInitialize)(this.gridUnCheck)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.gridChecked)).BeginInit(); - this.SuspendLayout(); - // - // gridUnCheck - // - this.gridUnCheck.AllowUserToAddRows = false; - this.gridUnCheck.AllowUserToDeleteRows = false; - this.gridUnCheck.AllowUserToResizeColumns = false; - this.gridUnCheck.AllowUserToResizeRows = false; - dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.gridUnCheck.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4; - this.gridUnCheck.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.gridUnCheck.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5; - this.gridUnCheck.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.gridUnCheck.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.uncheck序号, - this.uncheck条码, - this.uncheck产品名称, - this.uncheck规格, - this.uncheck数量, - this.uncheck重量}); - this.gridUnCheck.Location = new System.Drawing.Point(8, 8); - this.gridUnCheck.MultiSelect = false; - this.gridUnCheck.Name = "gridUnCheck"; - this.gridUnCheck.ReadOnly = true; - this.gridUnCheck.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.gridUnCheck.RowsDefaultCellStyle = dataGridViewCellStyle6; - this.gridUnCheck.RowTemplate.Height = 23; - this.gridUnCheck.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.gridUnCheck.Size = new System.Drawing.Size(712, 273); - this.gridUnCheck.TabIndex = 2; - // - // uncheck序号 - // - this.uncheck序号.HeaderText = "序号"; - this.uncheck序号.Name = "uncheck序号"; - this.uncheck序号.ReadOnly = true; - // - // uncheck条码 - // - this.uncheck条码.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.uncheck条码.HeaderText = "条码"; - this.uncheck条码.Name = "uncheck条码"; - this.uncheck条码.ReadOnly = true; - // - // uncheck产品名称 - // - this.uncheck产品名称.HeaderText = "产品名称"; - this.uncheck产品名称.Name = "uncheck产品名称"; - this.uncheck产品名称.ReadOnly = true; - this.uncheck产品名称.Width = 120; - // - // uncheck规格 - // - this.uncheck规格.HeaderText = "规格"; - this.uncheck规格.Name = "uncheck规格"; - this.uncheck规格.ReadOnly = true; - // - // uncheck数量 - // - this.uncheck数量.HeaderText = "数量"; - this.uncheck数量.Name = "uncheck数量"; - this.uncheck数量.ReadOnly = true; - // - // uncheck重量 - // - this.uncheck重量.HeaderText = "重量"; - this.uncheck重量.Name = "uncheck重量"; - this.uncheck重量.ReadOnly = true; - // - // gridChecked - // - this.gridChecked.AllowUserToAddRows = false; - this.gridChecked.AllowUserToDeleteRows = false; - this.gridChecked.AllowUserToResizeColumns = false; - this.gridChecked.AllowUserToResizeRows = false; - dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.gridChecked.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7; - this.gridChecked.BackgroundColor = System.Drawing.Color.White; - dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.gridChecked.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8; - this.gridChecked.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.gridChecked.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.序号, - this.条码, - this.产品名称, - this.规格, - this.数量, - this.重量}); - this.gridChecked.Location = new System.Drawing.Point(50, 351); - this.gridChecked.MultiSelect = false; - this.gridChecked.Name = "gridChecked"; - this.gridChecked.ReadOnly = true; - this.gridChecked.RowHeadersVisible = false; - dataGridViewCellStyle9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.gridChecked.RowsDefaultCellStyle = dataGridViewCellStyle9; - this.gridChecked.RowTemplate.Height = 23; - this.gridChecked.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.gridChecked.Size = new System.Drawing.Size(715, 280); - this.gridChecked.TabIndex = 3; - // - // 序号 - // - this.序号.HeaderText = "序号"; - this.序号.Name = "序号"; - this.序号.ReadOnly = true; - // - // 条码 - // - this.条码.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.条码.HeaderText = "条码"; - this.条码.Name = "条码"; - this.条码.ReadOnly = true; - // - // 产品名称 - // - this.产品名称.HeaderText = "产品名称"; - this.产品名称.Name = "产品名称"; - this.产品名称.ReadOnly = true; - this.产品名称.Width = 120; - // - // 规格 - // - this.规格.HeaderText = "规格"; - this.规格.Name = "规格"; - this.规格.ReadOnly = true; - // - // 数量 - // - this.数量.HeaderText = "数量"; - this.数量.Name = "数量"; - this.数量.ReadOnly = true; - // - // 重量 - // - this.重量.HeaderText = "重量"; - this.重量.Name = "重量"; - this.重量.ReadOnly = true; - // - // Test - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1026, 643); - this.Controls.Add(this.gridChecked); - this.Controls.Add(this.gridUnCheck); - this.Name = "Test"; - this.Text = "Test"; - ((System.ComponentModel.ISupportInitialize)(this.gridUnCheck)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.gridChecked)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private BWP.WinFormControl.UDataGridView gridUnCheck; - private System.Windows.Forms.DataGridViewTextBoxColumn uncheck序号; - private System.Windows.Forms.DataGridViewTextBoxColumn uncheck条码; - private System.Windows.Forms.DataGridViewTextBoxColumn uncheck产品名称; - private System.Windows.Forms.DataGridViewTextBoxColumn uncheck规格; - private System.Windows.Forms.DataGridViewTextBoxColumn uncheck数量; - private System.Windows.Forms.DataGridViewTextBoxColumn uncheck重量; - private BWP.WinFormControl.UDataGridView gridChecked; - private System.Windows.Forms.DataGridViewTextBoxColumn 序号; - private System.Windows.Forms.DataGridViewTextBoxColumn 条码; - private System.Windows.Forms.DataGridViewTextBoxColumn 产品名称; - private System.Windows.Forms.DataGridViewTextBoxColumn 规格; - private System.Windows.Forms.DataGridViewTextBoxColumn 数量; - private System.Windows.Forms.DataGridViewTextBoxColumn 重量; - } -} \ No newline at end of file diff --git a/TrunksIousOutInStore/Test.cs b/TrunksIousOutInStore/Test.cs deleted file mode 100644 index eb2ea28..0000000 --- a/TrunksIousOutInStore/Test.cs +++ /dev/null @@ -1,20 +0,0 @@ -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 TrunksIousOutInStore -{ - public partial class Test : Form - { - public Test() - { - InitializeComponent(); - } - } -} diff --git a/TrunksIousOutInStore/TrunksIousOutInStore.csproj b/TrunksIousOutInStore/TrunksIousOutInStore.csproj index 271bac9..fa5af1f 100644 --- a/TrunksIousOutInStore/TrunksIousOutInStore.csproj +++ b/TrunksIousOutInStore/TrunksIousOutInStore.csproj @@ -68,12 +68,6 @@ - - Form - - - Test.cs - Form @@ -88,9 +82,6 @@ - - Test.cs - TrunksIousOutInStoreForm.cs @@ -111,9 +102,7 @@ - - - + diff --git a/TrunksIousOutInStore/TrunksIousOutInStoreForm.Designer.cs b/TrunksIousOutInStore/TrunksIousOutInStoreForm.Designer.cs index 7a2e4bf..dd60c32 100644 --- a/TrunksIousOutInStore/TrunksIousOutInStoreForm.Designer.cs +++ b/TrunksIousOutInStore/TrunksIousOutInStoreForm.Designer.cs @@ -31,12 +31,13 @@ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.panel1 = new System.Windows.Forms.Panel(); this.btnEnableWeight = new System.Windows.Forms.Button(); @@ -57,13 +58,6 @@ this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.gridChecked = new BWP.WinFormControl.UDataGridView(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.gridUnCheck = new System.Windows.Forms.DataGridView(); - this.uncheck序号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.uncheck条码 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.uncheck产品名称 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.uncheck数量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.uncheck重量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.序号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.条码 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.产品名称 = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -71,6 +65,13 @@ this.入库重量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.胴体重量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.损耗 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.gridUnCheck = new System.Windows.Forms.DataGridView(); + this.uncheck序号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.uncheck条码 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.uncheck产品名称 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.uncheck数量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.uncheck重量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -346,6 +347,67 @@ this.gridChecked.Size = new System.Drawing.Size(659, 157); this.gridChecked.TabIndex = 4; // + // 序号 + // + this.序号.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.序号.DataPropertyName = "ID"; + this.序号.HeaderText = "序号"; + this.序号.Name = "序号"; + this.序号.ReadOnly = true; + this.序号.Width = 65; + // + // 条码 + // + this.条码.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.条码.DataPropertyName = "BarCode"; + this.条码.HeaderText = "条码"; + this.条码.Name = "条码"; + this.条码.ReadOnly = true; + this.条码.Width = 65; + // + // 产品名称 + // + this.产品名称.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.产品名称.DataPropertyName = "Goods_Name"; + this.产品名称.HeaderText = "产品名称"; + this.产品名称.Name = "产品名称"; + this.产品名称.ReadOnly = true; + this.产品名称.Width = 97; + // + // 数量 + // + this.数量.DataPropertyName = "Number"; + this.数量.HeaderText = "数量"; + this.数量.Name = "数量"; + this.数量.ReadOnly = true; + // + // 入库重量 + // + this.入库重量.DataPropertyName = "Weight"; + dataGridViewCellStyle3.Format = "#0.######"; + this.入库重量.DefaultCellStyle = dataGridViewCellStyle3; + this.入库重量.HeaderText = "入库重量"; + this.入库重量.Name = "入库重量"; + this.入库重量.ReadOnly = true; + // + // 胴体重量 + // + this.胴体重量.DataPropertyName = "BeforeWeight"; + dataGridViewCellStyle4.Format = "#0.######"; + this.胴体重量.DefaultCellStyle = dataGridViewCellStyle4; + this.胴体重量.HeaderText = "胴体重量"; + this.胴体重量.Name = "胴体重量"; + this.胴体重量.ReadOnly = true; + // + // 损耗 + // + this.损耗.DataPropertyName = "LossWeight"; + dataGridViewCellStyle5.Format = "#0.######"; + this.损耗.DefaultCellStyle = dataGridViewCellStyle5; + this.损耗.HeaderText = "损耗"; + this.损耗.Name = "损耗"; + this.损耗.ReadOnly = true; + // // groupBox1 // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -388,9 +450,9 @@ this.gridUnCheck.Name = "gridUnCheck"; this.gridUnCheck.ReadOnly = true; this.gridUnCheck.RowHeadersVisible = false; - dataGridViewCellStyle9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.gridUnCheck.RowsDefaultCellStyle = dataGridViewCellStyle9; + dataGridViewCellStyle10.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle10.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.gridUnCheck.RowsDefaultCellStyle = dataGridViewCellStyle10; this.gridUnCheck.RowTemplate.Height = 23; this.gridUnCheck.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.gridUnCheck.Size = new System.Drawing.Size(664, 200); @@ -431,71 +493,12 @@ // uncheck重量 // this.uncheck重量.DataPropertyName = "Weight"; + dataGridViewCellStyle9.Format = "#0.######"; + this.uncheck重量.DefaultCellStyle = dataGridViewCellStyle9; this.uncheck重量.HeaderText = "重量"; this.uncheck重量.Name = "uncheck重量"; this.uncheck重量.ReadOnly = true; // - // 序号 - // - this.序号.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; - this.序号.DataPropertyName = "ID"; - this.序号.HeaderText = "序号"; - this.序号.Name = "序号"; - this.序号.ReadOnly = true; - this.序号.Width = 65; - // - // 条码 - // - this.条码.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; - this.条码.DataPropertyName = "BarCode"; - this.条码.HeaderText = "条码"; - this.条码.Name = "条码"; - this.条码.ReadOnly = true; - this.条码.Width = 65; - // - // 产品名称 - // - this.产品名称.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; - this.产品名称.DataPropertyName = "Goods_Name"; - this.产品名称.HeaderText = "产品名称"; - this.产品名称.Name = "产品名称"; - this.产品名称.ReadOnly = true; - this.产品名称.Width = 97; - // - // 数量 - // - this.数量.DataPropertyName = "Number"; - this.数量.HeaderText = "数量"; - this.数量.Name = "数量"; - this.数量.ReadOnly = true; - // - // 入库重量 - // - this.入库重量.DataPropertyName = "Weight"; - dataGridViewCellStyle3.Format = "#0.######"; - this.入库重量.DefaultCellStyle = dataGridViewCellStyle3; - this.入库重量.HeaderText = "入库重量"; - this.入库重量.Name = "入库重量"; - this.入库重量.ReadOnly = true; - // - // 胴体重量 - // - this.胴体重量.DataPropertyName = "BeforeWeight"; - dataGridViewCellStyle4.Format = "#0.######"; - this.胴体重量.DefaultCellStyle = dataGridViewCellStyle4; - this.胴体重量.HeaderText = "胴体重量"; - this.胴体重量.Name = "胴体重量"; - this.胴体重量.ReadOnly = true; - // - // 损耗 - // - this.损耗.DataPropertyName = "LossWeight"; - dataGridViewCellStyle5.Format = "#0.######"; - this.损耗.DefaultCellStyle = dataGridViewCellStyle5; - this.损耗.HeaderText = "损耗"; - this.损耗.Name = "损耗"; - this.损耗.ReadOnly = true; - // // TrunksIousOutInStoreForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); diff --git a/TrunksIousOutInStore/TrunksIousOutInStoreForm.cs b/TrunksIousOutInStore/TrunksIousOutInStoreForm.cs index 56a4ca3..8198457 100644 --- a/TrunksIousOutInStore/TrunksIousOutInStoreForm.cs +++ b/TrunksIousOutInStore/TrunksIousOutInStoreForm.cs @@ -441,17 +441,19 @@ namespace TrunksIousOutInStore this.Invoke(new Action(() => { + if (cbxStore.SelectedValue == null) + throw new Exception("请选择入库仓库"); + if (cbxWorkUnit.SelectedValue == null) + throw new Exception("请选择工作单元"); + if (cbxBatch.SelectedValue == null) + throw new Exception("请选择生产批次"); + if (cbxWorkShop.SelectedValue != null) record.WorkShop_ID = Convert.ToInt64(cbxWorkShop.SelectedValue); - if (cbxWorkUnit.SelectedValue != null) - record.WorkUnit_ID = Convert.ToInt64(cbxWorkUnit.SelectedValue); - if (cbxStore.SelectedValue != null) - record.Store_ID = Convert.ToInt64(cbxStore.SelectedValue); - if (cbxBatch.SelectedValue != null) - { - record.ProductBatch_ID = Convert.ToInt64(cbxBatch.SelectedValue); - record.ProductBatch = cbxBatch.SelectedText; - } + record.WorkUnit_ID = Convert.ToInt64(cbxWorkUnit.SelectedValue); + record.Store_ID = Convert.ToInt64(cbxStore.SelectedValue); + record.ProductBatch_ID = Convert.ToInt64(cbxBatch.SelectedValue); + record.ProductBatch = cbxBatch.SelectedText; unSubmitList.Remove(fd); BindUnSubmitGrid(); }));