Browse Source

出入库 增加称重和扫码

master
wugang 8 years ago
parent
commit
761f1b0f0b
12 changed files with 1722 additions and 168 deletions
  1. +26
    -0
      TrunksIousOutInStore/Dto/TrunksIousOutInStoreFormDto.cs
  2. +239
    -0
      TrunksIousOutInStore/Test.Designer.cs
  3. +20
    -0
      TrunksIousOutInStore/Test.cs
  4. +156
    -0
      TrunksIousOutInStore/Test.resx
  5. +21
    -0
      TrunksIousOutInStore/TrunksIousOutInStore.csproj
  6. +77
    -0
      TrunksIousOutInStore/TrunksIousOutInStoreContext.cs
  7. +265
    -159
      TrunksIousOutInStore/TrunksIousOutInStoreForm.Designer.cs
  8. +373
    -9
      TrunksIousOutInStore/TrunksIousOutInStoreForm.cs
  9. +39
    -0
      TrunksIousOutInStore/TrunksIousOutInStoreForm.resx
  10. +291
    -0
      TrunksIousOutInStore/WeightSettingFrom.Designer.cs
  11. +95
    -0
      TrunksIousOutInStore/WeightSettingFrom.cs
  12. +120
    -0
      TrunksIousOutInStore/WeightSettingFrom.resx

+ 26
- 0
TrunksIousOutInStore/Dto/TrunksIousOutInStoreFormDto.cs View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TrunksIousOutInStore.Dto
{
public class TrunksIousOutInStoreFormDto
{
public long ID { get; set; }
public string Code { get; set; }
public string Goods_Name { get; set; }
public string Goods_Spec { get; set; }
private int mNumber = 1;
public int Number {
get { return mNumber; }
set { mNumber = value; }
}
public decimal? Weight { get; set; }
public int WeightType { get; set; }// 称重类型 跟白条状态有关
}
}

+ 239
- 0
TrunksIousOutInStore/Test.Designer.cs View File

@ -0,0 +1,239 @@
namespace TrunksIousOutInStore
{
partial class Test
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
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 ;
}
}

+ 20
- 0
TrunksIousOutInStore/Test.cs View File

@ -0,0 +1,20 @@
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();
}
}
}

+ 156
- 0
TrunksIousOutInStore/Test.resx View File

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="uncheck序号.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="uncheck条码.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="uncheck产品名称.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="uncheck规格.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="uncheck数量.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="uncheck重量.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="序号.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="条码.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="产品名称.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="规格.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="数量.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="重量.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

+ 21
- 0
TrunksIousOutInStore/TrunksIousOutInStore.csproj View File

@ -44,18 +44,38 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Dto\TrunksIousOutInStoreFormDto.cs" />
<Compile Include="TrunksIousOutInStoreContext.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Test.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Test.Designer.cs">
<DependentUpon>Test.cs</DependentUpon>
</Compile>
<Compile Include="TrunksIousOutInStoreForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="TrunksIousOutInStoreForm.Designer.cs">
<DependentUpon>TrunksIousOutInStoreForm.cs</DependentUpon>
</Compile>
<Compile Include="WeightSettingFrom.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="WeightSettingFrom.Designer.cs">
<DependentUpon>WeightSettingFrom.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Test.resx">
<DependentUpon>Test.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="TrunksIousOutInStoreForm.resx">
<DependentUpon>TrunksIousOutInStoreForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="WeightSettingFrom.resx">
<DependentUpon>WeightSettingFrom.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BO\BO.csproj">
@ -70,6 +90,7 @@
<ItemGroup>
<Content Include="模块说明.txt" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>


+ 77
- 0
TrunksIousOutInStore/TrunksIousOutInStoreContext.cs View File

@ -0,0 +1,77 @@
using System;
using System.IO;
using System.Windows.Forms;
using BO.Utils;
namespace TrunksIousOutInStore
{
public static class TrunksIousOutInStoreContext
{
private static string loginConfigPath = Application.StartupPath + "\\TrunksIousOutInStoreConfig.xml";
private static TrunksIousOutInStoreConfig _config;
public static TrunksIousOutInStoreConfig Config
{
get
{
if (_config == null)
_config = CreateConfig();
return _config;
}
}
static TrunksIousOutInStoreConfig CreateConfig()
{
var config = new TrunksIousOutInStoreConfig();
if (!File.Exists(loginConfigPath))
{
XmlUtil.SerializerObjToFile(config, loginConfigPath);
}
else
config = XmlUtil.DeserializeFromFile<TrunksIousOutInStoreConfig>(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 TrunksIousOutInStoreConfig
{
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; }
}
}

+ 265
- 159
TrunksIousOutInStore/TrunksIousOutInStoreForm.Designer.cs View File

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
@ -36,10 +37,7 @@
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.panel1 = new System.Windows.Forms.Panel();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.label1 = new System.Windows.Forms.Label();
this.weightControl1 = new BWP.WinFormControl.WeightControl();
this.button1 = new System.Windows.Forms.Button();
this.btnWeightSet = new System.Windows.Forms.Button();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.uComboBox1 = new BWP.WinFormControl.UComboBox();
this.label2 = new System.Windows.Forms.Label();
@ -47,12 +45,26 @@
this.btnSubmit = new System.Windows.Forms.Button();
this.btnSyncData = new System.Windows.Forms.Button();
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
this.splitContainer4 = new System.Windows.Forms.SplitContainer();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.uDataGridView1 = new BWP.WinFormControl.UDataGridView();
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();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.uDataGridView2 = new BWP.WinFormControl.UDataGridView();
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.uncheck重量 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.enableWeight = new System.Windows.Forms.CheckBox();
this.panel2 = new System.Windows.Forms.Panel();
this.lblChengZhong = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@ -65,20 +77,18 @@
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit();
this.splitContainer3.Panel1.SuspendLayout();
this.splitContainer3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer4)).BeginInit();
this.splitContainer4.Panel1.SuspendLayout();
this.splitContainer4.Panel2.SuspendLayout();
this.splitContainer4.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).BeginInit();
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.uDataGridView2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridChecked)).BeginInit();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridUnCheck)).BeginInit();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
@ -91,57 +101,32 @@
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(1276, 741);
this.splitContainer1.SplitterDistance = 99;
this.splitContainer1.SplitterDistance = 130;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 0;
//
// panel1
//
this.panel1.Controls.Add(this.richTextBox1);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.weightControl1);
this.panel1.Controls.Add(this.button1);
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.Controls.Add(this.enableWeight);
this.panel1.Controls.Add(this.panel2);
this.panel1.Controls.Add(this.btnWeightSet);
this.panel1.Location = new System.Drawing.Point(11, 3);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1251, 100);
this.panel1.TabIndex = 1;
//
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(426, 5);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(277, 90);
this.richTextBox1.TabIndex = 2;
this.richTextBox1.Text = "";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(314, 33);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(106, 24);
this.label1.TabIndex = 1;
this.label1.Text = "扫码区:";
// btnWeightSet
//
// weightControl1
//
this.weightControl1.Location = new System.Drawing.Point(3, 5);
this.weightControl1.Name = "weightControl1";
this.weightControl1.Size = new System.Drawing.Size(156, 92);
this.weightControl1.TabIndex = 0;
this.weightControl1.TypeOfWeight = BWP.WinFormControl.WeightType.Xk3190A9;
this.weightControl1.ValueFormat = "0.00";
//
// button1
//
this.button1.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.Location = new System.Drawing.Point(1158, 22);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(90, 46);
this.button1.TabIndex = 0;
this.button1.Text = "称设置";
this.button1.UseVisualStyleBackColor = true;
this.btnWeightSet.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnWeightSet.Location = new System.Drawing.Point(249, 53);
this.btnWeightSet.Name = "btnWeightSet";
this.btnWeightSet.Size = new System.Drawing.Size(111, 33);
this.btnWeightSet.TabIndex = 0;
this.btnWeightSet.Text = "称设置";
this.btnWeightSet.UseVisualStyleBackColor = true;
this.btnWeightSet.Click += new System.EventHandler(this.btnWeightSet_Click);
//
// splitContainer2
//
@ -161,8 +146,8 @@
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.splitContainer3);
this.splitContainer2.Size = new System.Drawing.Size(1276, 641);
this.splitContainer2.SplitterDistance = 261;
this.splitContainer2.Size = new System.Drawing.Size(1276, 610);
this.splitContainer2.SplitterDistance = 260;
this.splitContainer2.SplitterWidth = 1;
this.splitContainer2.TabIndex = 0;
//
@ -228,55 +213,35 @@
//
// splitContainer3.Panel1
//
this.splitContainer3.Panel1.Controls.Add(this.splitContainer4);
this.splitContainer3.Size = new System.Drawing.Size(1014, 641);
this.splitContainer3.Panel1.Controls.Add(this.groupBox2);
this.splitContainer3.Panel1.Controls.Add(this.groupBox1);
this.splitContainer3.Size = new System.Drawing.Size(1015, 610);
this.splitContainer3.SplitterDistance = 726;
this.splitContainer3.SplitterWidth = 1;
this.splitContainer3.TabIndex = 0;
//
// splitContainer4
//
this.splitContainer4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer4.Location = new System.Drawing.Point(0, 0);
this.splitContainer4.Name = "splitContainer4";
this.splitContainer4.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer4.Panel1
//
this.splitContainer4.Panel1.Controls.Add(this.groupBox2);
this.splitContainer4.Panel1.Controls.Add(this.groupBox1);
//
// splitContainer4.Panel2
//
this.splitContainer4.Panel2.Controls.Add(this.groupBox3);
this.splitContainer4.Size = new System.Drawing.Size(726, 641);
this.splitContainer4.SplitterDistance = 320;
this.splitContainer4.SplitterWidth = 1;
this.splitContainer4.TabIndex = 0;
//
// groupBox2
//
this.groupBox2.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.groupBox2.Controls.Add(this.uDataGridView1);
this.groupBox2.Location = new System.Drawing.Point(3, 2);
this.groupBox2.Controls.Add(this.gridChecked);
this.groupBox2.Location = new System.Drawing.Point(14, 259);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(718, 312);
this.groupBox2.TabIndex = 0;
this.groupBox2.Size = new System.Drawing.Size(699, 340);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "待提交明细";
this.groupBox2.Text = "已提交";
//
// uDataGridView1
// gridChecked
//
this.uDataGridView1.AllowUserToAddRows = false;
this.uDataGridView1.AllowUserToDeleteRows = false;
this.uDataGridView1.AllowUserToResizeColumns = false;
this.uDataGridView1.AllowUserToResizeRows = false;
this.gridChecked.AllowUserToAddRows = false;
this.gridChecked.AllowUserToDeleteRows = false;
this.gridChecked.AllowUserToResizeColumns = false;
this.gridChecked.AllowUserToResizeRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.uDataGridView1.BackgroundColor = System.Drawing.Color.White;
this.gridChecked.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.gridChecked.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F);
@ -284,56 +249,94 @@
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.uDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.uDataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.uDataGridView1.Location = new System.Drawing.Point(3, 17);
this.uDataGridView1.MultiSelect = false;
this.uDataGridView1.Name = "uDataGridView1";
this.uDataGridView1.ReadOnly = true;
this.uDataGridView1.RowHeadersVisible = false;
this.gridChecked.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
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.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridChecked.Location = new System.Drawing.Point(3, 17);
this.gridChecked.MultiSelect = false;
this.gridChecked.Name = "gridChecked";
this.gridChecked.ReadOnly = true;
this.gridChecked.RowHeadersVisible = false;
dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle3;
this.uDataGridView1.RowTemplate.Height = 23;
this.uDataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.uDataGridView1.Size = new System.Drawing.Size(712, 292);
this.uDataGridView1.TabIndex = 0;
this.gridChecked.RowsDefaultCellStyle = dataGridViewCellStyle3;
this.gridChecked.RowTemplate.Height = 23;
this.gridChecked.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.gridChecked.Size = new System.Drawing.Size(693, 320);
this.gridChecked.TabIndex = 4;
//
// 序号
//
this..DataPropertyName = "ID";
this..HeaderText = "序号";
this..Name = "序号";
this..ReadOnly = true;
//
// 条码
//
this..AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this..DataPropertyName = "Code";
this..HeaderText = "条码";
this..Name = "条码";
this..ReadOnly = true;
//
// 产品名称
//
this..DataPropertyName = "Goods_Name";
this..HeaderText = "产品名称";
this..Name = "产品名称";
this..ReadOnly = true;
this..Width = 120;
//
// 规格
//
this..DataPropertyName = "Goods_Spec";
this..HeaderText = "规格";
this..Name = "规格";
this..ReadOnly = true;
//
// 数量
//
this..DataPropertyName = "Number";
this..HeaderText = "数量";
this..Name = "数量";
this..ReadOnly = true;
//
// 重量
//
this..DataPropertyName = "Weight";
this..HeaderText = "重量";
this..Name = "重量";
this..ReadOnly = true;
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Location = new System.Drawing.Point(3, 3);
this.groupBox1.Controls.Add(this.gridUnCheck);
this.groupBox1.Location = new System.Drawing.Point(14, 15);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(718, 312);
this.groupBox1.Size = new System.Drawing.Size(705, 220);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "groupBox1";
this.groupBox1.Text = "待提交";
//
// groupBox3
// gridUnCheck
//
this.groupBox3.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.groupBox3.Controls.Add(this.uDataGridView2);
this.groupBox3.Location = new System.Drawing.Point(3, 3);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(718, 319);
this.groupBox3.TabIndex = 0;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "产品明细";
//
// uDataGridView2
//
this.uDataGridView2.AllowUserToAddRows = false;
this.uDataGridView2.AllowUserToDeleteRows = false;
this.uDataGridView2.AllowUserToResizeColumns = false;
this.uDataGridView2.AllowUserToResizeRows = false;
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.uDataGridView2.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4;
this.uDataGridView2.BackgroundColor = System.Drawing.Color.White;
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);
@ -341,21 +344,111 @@
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uDataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5;
this.uDataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.uDataGridView2.Dock = System.Windows.Forms.DockStyle.Fill;
this.uDataGridView2.Location = new System.Drawing.Point(3, 17);
this.uDataGridView2.MultiSelect = false;
this.uDataGridView2.Name = "uDataGridView2";
this.uDataGridView2.ReadOnly = true;
this.uDataGridView2.RowHeadersVisible = false;
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.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridUnCheck.Location = new System.Drawing.Point(3, 17);
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.uDataGridView2.RowsDefaultCellStyle = dataGridViewCellStyle6;
this.uDataGridView2.RowTemplate.Height = 23;
this.uDataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.uDataGridView2.Size = new System.Drawing.Size(712, 299);
this.uDataGridView2.TabIndex = 0;
this.gridUnCheck.RowsDefaultCellStyle = dataGridViewCellStyle6;
this.gridUnCheck.RowTemplate.Height = 23;
this.gridUnCheck.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.gridUnCheck.Size = new System.Drawing.Size(699, 200);
this.gridUnCheck.TabIndex = 3;
//
// uncheck序号
//
this.uncheck序号.DataPropertyName = "ID";
this.uncheck序号.HeaderText = "序号";
this.uncheck序号.Name = "uncheck序号";
this.uncheck序号.ReadOnly = true;
//
// uncheck条码
//
this.uncheck条码.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.uncheck条码.DataPropertyName = "Code";
this.uncheck条码.HeaderText = "条码";
this.uncheck条码.Name = "uncheck条码";
this.uncheck条码.ReadOnly = true;
//
// uncheck产品名称
//
this.uncheck产品名称.DataPropertyName = "Goods_Name";
this.uncheck产品名称.HeaderText = "产品名称";
this.uncheck产品名称.Name = "uncheck产品名称";
this.uncheck产品名称.ReadOnly = true;
this.uncheck产品名称.Width = 120;
//
// uncheck规格
//
this.uncheck规格.DataPropertyName = "Goods_Spec";
this.uncheck规格.HeaderText = "规格";
this.uncheck规格.Name = "uncheck规格";
this.uncheck规格.ReadOnly = true;
//
// uncheck数量
//
this.uncheck数量.DataPropertyName = "Number";
this.uncheck数量.HeaderText = "数量";
this.uncheck数量.Name = "uncheck数量";
this.uncheck数量.ReadOnly = true;
//
// uncheck重量
//
this.uncheck重量.DataPropertyName = "Weight";
this.uncheck重量.HeaderText = "重量";
this.uncheck重量.Name = "uncheck重量";
this.uncheck重量.ReadOnly = true;
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// enableWeight
//
this.enableWeight.AutoCheck = false;
this.enableWeight.AutoSize = true;
this.enableWeight.Font = new System.Drawing.Font("宋体", 18F);
this.enableWeight.Location = new System.Drawing.Point(249, 8);
this.enableWeight.Name = "enableWeight";
this.enableWeight.Size = new System.Drawing.Size(125, 28);
this.enableWeight.TabIndex = 33;
this.enableWeight.Text = "启用称重";
this.enableWeight.UseVisualStyleBackColor = true;
this.enableWeight.Click += new System.EventHandler(this.enableWeight_Click);
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Black;
this.panel2.Controls.Add(this.lblChengZhong);
this.panel2.Location = new System.Drawing.Point(3, 8);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(237, 78);
this.panel2.TabIndex = 32;
//
// lblChengZhong
//
this.lblChengZhong.AutoSize = true;
this.lblChengZhong.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblChengZhong.ForeColor = System.Drawing.Color.Red;
this.lblChengZhong.Location = new System.Drawing.Point(15, 18);
this.lblChengZhong.Name = "lblChengZhong";
this.lblChengZhong.Size = new System.Drawing.Size(97, 40);
this.lblChengZhong.TabIndex = 0;
this.lblChengZhong.Text = "0.00";
//
// TrunksIousOutInStoreForm
//
@ -363,11 +456,15 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1276, 741);
this.Controls.Add(this.splitContainer1);
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "TrunksIousOutInStoreForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "胴体白条出入库";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TrunksIousOutInStoreForm_FormClosing);
this.Load += new System.EventHandler(this.TrunksIousOutInStoreForm_Load);
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.TrunksIousOutInStoreForm_KeyUp);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
@ -383,14 +480,12 @@
this.splitContainer3.Panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit();
this.splitContainer3.ResumeLayout(false);
this.splitContainer4.Panel1.ResumeLayout(false);
this.splitContainer4.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer4)).EndInit();
this.splitContainer4.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).EndInit();
this.groupBox3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.uDataGridView2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gridChecked)).EndInit();
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridUnCheck)).EndInit();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.ResumeLayout(false);
}
@ -399,9 +494,6 @@
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Label label1;
private BWP.WinFormControl.WeightControl weightControl1;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.Button btnSyncData;
private System.Windows.Forms.SplitContainer splitContainer3;
@ -409,12 +501,26 @@
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnCreateBill;
private System.Windows.Forms.Button btnSubmit;
private System.Windows.Forms.SplitContainer splitContainer4;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button btnWeightSet;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Button button1;
private BWP.WinFormControl.UDataGridView uDataGridView1;
private BWP.WinFormControl.UDataGridView uDataGridView2;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.DataGridView gridUnCheck;
private BWP.WinFormControl.UDataGridView gridChecked;
private System.Windows.Forms.Timer timer1;
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 ;
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 System.Windows.Forms.CheckBox enableWeight;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label lblChengZhong;
}
}

+ 373
- 9
TrunksIousOutInStore/TrunksIousOutInStoreForm.cs View File

@ -1,46 +1,410 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using BO.Utils;
using BO.Utils.BillRpc;
using BWP.WinFormControl.WeightDataFormat;
using TrunksIousOutInStore.Dto;
namespace TrunksIousOutInStore
{
public partial class TrunksIousOutInStoreForm : Form,IAfterLogin
public partial class TrunksIousOutInStoreForm : Form, IAfterLogin
{
SerialPort weightPort;
#region weightNeed
private IDataFormat _dataFormat;
private Thread _inQueryThread;
private bool _mainProcessIsRun;
readonly StringBuilder _dataStrBuilder = new StringBuilder();
#endregion
public TrunksIousOutInStoreForm()
{
InitializeComponent();
gridUnCheck.AutoGenerateColumns = false;
gridChecked.AutoGenerateColumns = false;
weightPort = new SerialPort();
this.FormClosing += delegate
{
if (_inQueryThread != null && _inQueryThread.IsAlive)
DisableWeight();
// if (syncWork != null && syncWork.IsAlive)
// syncWork.Abort();
// if (syncToServer != null && syncToServer.IsAlive)
// syncToServer.Abort();
};
}
#region weightNeed
void OpenSerialPort()
{
if (enableWeight.Checked)
return;
if (TrunksIousOutInStoreContext.Config.RateSet == null)
throw new Exception("请先配置称相关信息");
weightPort.PortName = TrunksIousOutInStoreContext.Config.ComSet;
weightPort.BaudRate = TrunksIousOutInStoreContext.Config.RateSet.Value;
weightPort.DataBits = TrunksIousOutInStoreContext.Config.BitSet.Value;
weightPort.ReadBufferSize = 4096 * 100;
if (!string.IsNullOrEmpty(TrunksIousOutInStoreContext.Config.Format))
format = "{0:{format}}".Replace("{format}", TrunksIousOutInStoreContext.Config.Format);
switch (TrunksIousOutInStoreContext.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 (TrunksIousOutInStoreContext.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);
}
}
}
}
private class WeighAvgControl
{
public static bool TryGetValue(out decimal result)
{
List<Tuple<decimal, bool>> list;
if (mWeighList.TryDequeue(out list))
{
var r = list.Where(x => x.Item2).Select(x => x.Item1).GroupBy(x => x);
var firstOrDefault = r.OrderByDescending(x => x.Count()).FirstOrDefault();
if (firstOrDefault != null)
{
result = firstOrDefault.Key;
return true;
}
result = 0;
return false;
}
result = 0;
return false;
}
static ConcurrentQueue<List<Tuple<decimal, bool>>> mWeighList = new ConcurrentQueue<List<Tuple<decimal, bool>>>();
static List<Tuple<decimal, bool>> _list = new List<Tuple<decimal, bool>>();
public static void Add(decimal value, bool isStatic)
{
if (value >= TrunksIousOutInStoreContext.Config.MinWeight && value <= TrunksIousOutInStoreContext.Config.MaxWeight)
{
_list.Add(new Tuple<decimal, bool>(value, isStatic));
}
else
{
if (_list.Count > 0)
{
mWeighList.Enqueue(_list);
_list = new List<Tuple<decimal, bool>>();
}
}
}
}
void DisableWeight()
{
_mainProcessIsRun = false;
lblChengZhong.Text = string.Format(format, 0);
format = "{0:0.00}";
Thread.Sleep(10);
if (_inQueryThread.IsAlive)
{
_inQueryThread.Abort();
}
if (weightPort.IsOpen)
weightPort.Close();
}
public void enableWeight_Click(object sender, EventArgs e)
{
if (!enableWeight.Checked)
{
OpenSerialPort();
_mainProcessIsRun = true;
ReadData();
}
else
{
DisableWeight();
}
enableWeight.CheckState = enableWeight.Checked ? CheckState.Unchecked : CheckState.Checked;
}
#endregion
private string barCode;
private void TrunksIousOutInStoreForm_KeyUp(object sender, KeyEventArgs e)
{
switch (e.KeyData)
{
case Keys.S:
break;
case Keys.E:
case Keys.Enter:
barCode = "";
break;
default:
richTextBox1.Text += (char)e.KeyValue;
barCode += (char)e.KeyValue;
barCode = barCode.Replace("\r", "").Replace("\t", "");
if (barCode.Length == 4)
{
doInsertUnSubmit(barCode, null);
barCode = "";
}
break;
}
}
static object _obj = new object();
private void doInsertUnSubmit(string barCode, decimal? weight)
{
lock (_obj)
{
var dto = new TrunksIousOutInStoreFormDto();
dto.Goods_Name = "白条";
dto.Goods_Name = "规格";
dto.Number = 1;
if (!string.IsNullOrWhiteSpace(barCode))
{//扫码
dto.Code = barCode;
//找到条码为空但是重量不为空的
var fd = unSumbitList.FirstOrDefault(x => string.IsNullOrWhiteSpace(x.Code) && x.Weight.HasValue);
if (fd == null)
{
unSumbitList.Add(dto);
}
else
{
//给条码赋值
fd.Code = barCode;
}
}
if (weight.HasValue)
{//称重
dto.Weight = weight;
//找到称重为空条码不为空的
var fd = unSumbitList.FirstOrDefault(x => !string.IsNullOrWhiteSpace(x.Code) && x.Weight==null);
if (fd == null)
{
unSumbitList.Add(dto);
}
else
{
//给条码赋值
fd.Weight = weight;
}
}
BindUnCheckGrid();
}
// barCodequeue.Enqueue(barCode);
}
public string RoleName {
public string RoleName
{
get { return "胴体白条出入库"; }
}
public Form Generate()
{
return this;
}
private void TrunksIousOutInStoreForm_Load(object sender, EventArgs e)
{
}
private void TrunksIousOutInStoreForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (unSumbitList.Count > 0)
{
if (MessageBox.Show("待提交区域不为空,确定关闭?", "确定关闭", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) ==
DialogResult.OK)
{
e.Cancel = false;
}
else
{
e.Cancel = true;
}
}
}
BindingList<TrunksIousOutInStoreFormDto> unSumbitList = new BindingList<TrunksIousOutInStoreFormDto>();
BindingList<TrunksIousOutInStoreFormDto> sumbitedList = new BindingList<TrunksIousOutInStoreFormDto>();
// ConcurrentQueue<string> barCodequeue=new ConcurrentQueue<string>();
private void timer1_Tick(object sender, EventArgs e)
{
var canSubmitList = unSumbitList.Where(x => !string.IsNullOrWhiteSpace(x.Code) && x.Weight != null).ToList();
foreach (TrunksIousOutInStoreFormDto canSubmitDto in canSubmitList)
{
unSumbitList.Remove(canSubmitDto);
//todo 插入数据库操作
sumbitedList.Insert(0, canSubmitDto);
}
BindUnCheckGrid();
BindCheckedGrid();
}
void BindUnCheckGrid()
{
gridUnCheck.DataSource = unSumbitList;
}
void BindCheckedGrid()
{
gridChecked.DataSource = sumbitedList;
}
private void btnWeightSet_Click(object sender, EventArgs e)
{
var f = new WeightSettingFrom();
if (f.ShowDialog() == DialogResult.OK)
{
enableWeight_Click(sender, e);
}
}
}
}

+ 39
- 0
TrunksIousOutInStore/TrunksIousOutInStoreForm.resx View File

@ -117,4 +117,43 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="序号.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="条码.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="产品名称.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="规格.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="数量.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="重量.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="uncheck序号.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="uncheck条码.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="uncheck产品名称.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="uncheck规格.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="uncheck数量.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="uncheck重量.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>8, 19</value>
</metadata>
</root>

+ 291
- 0
TrunksIousOutInStore/WeightSettingFrom.Designer.cs View File

@ -0,0 +1,291 @@
namespace TrunksIousOutInStore
{
partial class WeightSettingFrom
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.maxInput = new BWP.WinFormControl.UTextBoxWithPad();
this.minInput = new BWP.WinFormControl.UTextBoxWithPad();
this.label8 = new System.Windows.Forms.Label();
this.weightReadType = new System.Windows.Forms.ComboBox();
this.label7 = new System.Windows.Forms.Label();
this.discont = new BWP.WinFormControl.UTextBoxWithPad();
this.format = new BWP.WinFormControl.UTextBoxWithPad();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.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.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;
}
}

+ 95
- 0
TrunksIousOutInStore/WeightSettingFrom.cs View File

@ -0,0 +1,95 @@
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 WeightSettingFrom : Form
{
List<string> weight = new List<string> { "IND560", "Xk3124", "Xk3190A9", "Xk3190D10" };
List<string> com = new List<string> { "COM1", "COM2", "COM3", "COM4", "COM5" };
List<string> rate = new List<string> { "4800", "7200", "9600" };
List<string> bit = new List<string> { "5", "6", "7", "8" };
List<string> weightRead = new List<string> { "稳定读取", "连续发送" };
public WeightSettingFrom()
{
InitializeComponent();
weightSet.DataSource = weight;
comSet.DataSource = com;
rateSet.DataSource = rate;
bitSet.DataSource = bit;
weightReadType.DataSource = weightRead;
if (!string.IsNullOrEmpty(TrunksIousOutInStoreContext.Config.WeightSet))
weightSet.SelectedIndex = weight.IndexOf(TrunksIousOutInStoreContext.Config.WeightSet);
else
weightSet.SelectedIndex = 0;
if (!string.IsNullOrEmpty(TrunksIousOutInStoreContext.Config.ComSet))
comSet.SelectedIndex = com.IndexOf(TrunksIousOutInStoreContext.Config.ComSet);
else
comSet.SelectedIndex = 0;
if (TrunksIousOutInStoreContext.Config.RateSet.HasValue)
rateSet.SelectedIndex = rate.IndexOf(TrunksIousOutInStoreContext.Config.RateSet.ToString());
else
rateSet.SelectedIndex = 2;
if (TrunksIousOutInStoreContext.Config.BitSet.HasValue)
bitSet.SelectedIndex = bit.IndexOf(TrunksIousOutInStoreContext.Config.BitSet.ToString());
else
bitSet.SelectedIndex = 3;
if (string.IsNullOrEmpty(TrunksIousOutInStoreContext.Config.Format))
format.Text = "0.00";
else
format.Text = TrunksIousOutInStoreContext.Config.Format;
if (TrunksIousOutInStoreContext.Config.Discont == null)
discont.Text = "0.00";
else
discont.Text = TrunksIousOutInStoreContext.Config.Discont.ToString();
weightReadType.SelectedIndex = TrunksIousOutInStoreContext.Config.WeightType;
minInput.Text = TrunksIousOutInStoreContext.Config.MinWeight.ToString();
maxInput.Text = TrunksIousOutInStoreContext.Config.MaxWeight.ToString();
}
private void saveBtn_Click(object sender, EventArgs e)
{
TrunksIousOutInStoreContext.Config.WeightSet = weight[this.weightSet.SelectedIndex];
TrunksIousOutInStoreContext.Config.ComSet = com[this.comSet.SelectedIndex];
TrunksIousOutInStoreContext.Config.RateSet = int.Parse(rate[this.rateSet.SelectedIndex]);
TrunksIousOutInStoreContext.Config.BitSet = int.Parse(bit[this.bitSet.SelectedIndex]);
TrunksIousOutInStoreContext.Config.Format = format.Text;
TrunksIousOutInStoreContext.Config.WeightType = weightReadType.SelectedIndex;
if (TrunksIousOutInStoreContext.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("连续发送时 必须输入有效区间");
TrunksIousOutInStoreContext.Config.MinWeight = min;
TrunksIousOutInStoreContext.Config.MaxWeight = max;
}
if (!string.IsNullOrEmpty(discont.Text))
{
decimal v;
if (decimal.TryParse(discont.Text, out v))
TrunksIousOutInStoreContext.Config.Discont = v;
else
throw new Exception("扣重格式输入不正确");
}
else
TrunksIousOutInStoreContext.Config.Discont = 0;
TrunksIousOutInStoreContext.Save();
MessageBox.Show("保存成功!");
}
private void closeBtn_Click(object sender, EventArgs e)
{
Close();
}
}
}

+ 120
- 0
TrunksIousOutInStore/WeightSettingFrom.resx View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

Loading…
Cancel
Save