Browse Source

添加副产品客户端

master
wugang 8 years ago
parent
commit
8e992e45d8
20 changed files with 2275 additions and 43 deletions
  1. +6
    -0
      B3ButcherManageClient.sln
  2. +109
    -0
      ByProductWeight/ByProductWeight.csproj
  3. +82
    -0
      ByProductWeight/ByProductWeightContext.cs
  4. +478
    -0
      ByProductWeight/ByProductWeightForm.Designer.cs
  5. +406
    -0
      ByProductWeight/ByProductWeightForm.cs
  6. +150
    -0
      ByProductWeight/ByProductWeightForm.resx
  7. +14
    -0
      ByProductWeight/ByProductWeightGoodsSet.cs
  8. +118
    -0
      ByProductWeight/ByProductWeightGoodsSetForm.Designer.cs
  9. +142
    -0
      ByProductWeight/ByProductWeightGoodsSetForm.cs
  10. +120
    -0
      ByProductWeight/ByProductWeightGoodsSetForm.resx
  11. +36
    -0
      ByProductWeight/Properties/AssemblyInfo.cs
  12. +21
    -0
      ByProductWeight/Rpc/ByProductWeightRecordRpc.cs
  13. +22
    -0
      ByProductWeight/Rpc/Dto/ByProductWeightRecord.cs
  14. +291
    -0
      ByProductWeight/WeightSettingFrom.Designer.cs
  15. +95
    -0
      ByProductWeight/WeightSettingFrom.cs
  16. +120
    -0
      ByProductWeight/WeightSettingFrom.resx
  17. +1
    -0
      ByProductWeight/副产品称重.txt
  18. +39
    -36
      SegmentationWeight/SegmentationWeightForm.Designer.cs
  19. +8
    -3
      SegmentationWeight/SegmentationWeightForm.cs
  20. +17
    -4
      WeighAndGrading/GradeFrom.cs

+ 6
- 0
B3ButcherManageClient.sln View File

@ -31,6 +31,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SegmentationWeight", "Segme
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SegmentationInStore", "SegmentationInStore\SegmentationInStore.csproj", "{7528B945-C2CC-4266-83BD-D2214140C4BD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ByProductWeight", "ByProductWeight\ByProductWeight.csproj", "{C5696A7D-0BEB-474A-A478-FD0543E72ABF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -91,6 +93,10 @@ Global
{7528B945-C2CC-4266-83BD-D2214140C4BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7528B945-C2CC-4266-83BD-D2214140C4BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7528B945-C2CC-4266-83BD-D2214140C4BD}.Release|Any CPU.Build.0 = Release|Any CPU
{C5696A7D-0BEB-474A-A478-FD0543E72ABF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C5696A7D-0BEB-474A-A478-FD0543E72ABF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C5696A7D-0BEB-474A-A478-FD0543E72ABF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C5696A7D-0BEB-474A-A478-FD0543E72ABF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE


+ 109
- 0
ByProductWeight/ByProductWeight.csproj View File

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C5696A7D-0BEB-474A-A478-FD0543E72ABF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ByProductWeight</RootNamespace>
<AssemblyName>ByProductWeight</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Forks.JsonRpc.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\tsref\Debug\Forks.JsonRpc.Client.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=4.0.3.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\tsref\Debug\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ByProductWeightContext.cs" />
<Compile Include="ByProductWeightForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ByProductWeightForm.Designer.cs">
<DependentUpon>ByProductWeightForm.cs</DependentUpon>
</Compile>
<Compile Include="ByProductWeightGoodsSet.cs" />
<Compile Include="ByProductWeightGoodsSetForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ByProductWeightGoodsSetForm.Designer.cs">
<DependentUpon>ByProductWeightGoodsSetForm.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Rpc\ByProductWeightRecordRpc.cs" />
<Compile Include="Rpc\Dto\ByProductWeightRecord.cs" />
<Compile Include="WeightSettingFrom.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="WeightSettingFrom.Designer.cs">
<DependentUpon>WeightSettingFrom.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="副产品称重.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ByProductWeightForm.resx">
<DependentUpon>ByProductWeightForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ByProductWeightGoodsSetForm.resx">
<DependentUpon>ByProductWeightGoodsSetForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="WeightSettingFrom.resx">
<DependentUpon>WeightSettingFrom.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BO\BO.csproj">
<Project>{8968f14a-c7c7-4751-96ce-b114fbfd65ef}</Project>
<Name>BO</Name>
</ProjectReference>
<ProjectReference Include="..\BWP.WinFormControl\BWP.WinFormControl.csproj">
<Project>{a782b23e-be6d-4f51-b5cb-5cd259ba97cc}</Project>
<Name>BWP.WinFormControl</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

+ 82
- 0
ByProductWeight/ByProductWeightContext.cs View File

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

+ 478
- 0
ByProductWeight/ByProductWeightForm.Designer.cs View File

@ -0,0 +1,478 @@
namespace ByProductWeight
{
partial class ByProductWeightForm
{
/// <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 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.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.lblGoodsName = new System.Windows.Forms.Label();
this.lblWeight = new System.Windows.Forms.Label();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.lblNumber = new System.Windows.Forms.Label();
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.flpGoods = new System.Windows.Forms.FlowLayoutPanel();
this.flpClass = new System.Windows.Forms.FlowLayoutPanel();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.btnWeightSet = new System.Windows.Forms.Button();
this.lblChengZhong = new System.Windows.Forms.Label();
this.btnGoodsSet = new System.Windows.Forms.Button();
this.enableWeight = new System.Windows.Forms.CheckBox();
this.panel2 = new System.Windows.Forms.Panel();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.panel1 = new System.Windows.Forms.Panel();
this.uDataGridView1 = 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.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).BeginInit();
this.SuspendLayout();
//
// label1
//
this.label1.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.label1.Location = new System.Drawing.Point(4, 1);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(274, 50);
this.label1.TabIndex = 0;
this.label1.Text = "产品";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label2
//
this.label2.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.label2.Location = new System.Drawing.Point(285, 1);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(139, 50);
this.label2.TabIndex = 0;
this.label2.Text = "数量";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label3
//
this.label3.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.label3.Location = new System.Drawing.Point(431, 1);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(83, 50);
this.label3.TabIndex = 0;
this.label3.Text = "重量";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblGoodsName
//
this.lblGoodsName.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.lblGoodsName.Location = new System.Drawing.Point(4, 52);
this.lblGoodsName.Name = "lblGoodsName";
this.lblGoodsName.Size = new System.Drawing.Size(274, 45);
this.lblGoodsName.TabIndex = 0;
this.lblGoodsName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblWeight
//
this.lblWeight.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.lblWeight.Location = new System.Drawing.Point(431, 52);
this.lblWeight.Name = "lblWeight";
this.lblWeight.Size = new System.Drawing.Size(83, 45);
this.lblWeight.TabIndex = 0;
this.lblWeight.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel1.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single;
this.tableLayoutPanel1.ColumnCount = 3;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 65.90909F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 34.09091F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 88F));
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.label2, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.label3, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.lblGoodsName, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.lblNumber, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.lblWeight, 2, 1);
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 4);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 53.57143F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 46.42857F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(518, 98);
this.tableLayoutPanel1.TabIndex = 0;
//
// lblNumber
//
this.lblNumber.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.lblNumber.Location = new System.Drawing.Point(285, 52);
this.lblNumber.Name = "lblNumber";
this.lblNumber.Size = new System.Drawing.Size(139, 45);
this.lblNumber.TabIndex = 0;
this.lblNumber.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// 毛重
//
this..DataPropertyName = "MaoWeight";
this..HeaderText = "毛重";
this..Name = "毛重";
this..ReadOnly = true;
this..Width = 80;
//
// 净重
//
this..DataPropertyName = "JingWeight";
this..HeaderText = "净重";
this..Name = "净重";
this..ReadOnly = true;
this..Width = 80;
//
// 产品
//
this..AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this..DataPropertyName = "Goods_Name";
this..HeaderText = "产品";
this..MinimumWidth = 100;
this..Name = "产品";
this..ReadOnly = true;
//
// 条码
//
this..DataPropertyName = "BarCode";
this..HeaderText = "条码";
this..Name = "条码";
this..ReadOnly = true;
//
// 序号
//
this..DataPropertyName = "ID";
this..HeaderText = "序号";
this..Name = "序号";
this..ReadOnly = true;
this..Width = 80;
//
// 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, 87);
this.flpGoods.Name = "flpGoods";
this.flpGoods.Size = new System.Drawing.Size(494, 395);
this.flpGoods.TabIndex = 1;
//
// 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(4, 4);
this.flpClass.Name = "flpClass";
this.flpClass.Size = new System.Drawing.Size(494, 76);
this.flpClass.TabIndex = 0;
//
// splitContainer2
//
this.splitContainer2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.flpGoods);
this.splitContainer2.Panel1.Controls.Add(this.flpClass);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.uDataGridView1);
this.splitContainer2.Panel2.Controls.Add(this.tableLayoutPanel1);
this.splitContainer2.Size = new System.Drawing.Size(1041, 487);
this.splitContainer2.SplitterDistance = 515;
this.splitContainer2.SplitterWidth = 1;
this.splitContainer2.TabIndex = 0;
//
// btnWeightSet
//
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);
//
// 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";
//
// btnGoodsSet
//
this.btnGoodsSet.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnGoodsSet.Location = new System.Drawing.Point(427, 23);
this.btnGoodsSet.Name = "btnGoodsSet";
this.btnGoodsSet.Size = new System.Drawing.Size(114, 63);
this.btnGoodsSet.TabIndex = 34;
this.btnGoodsSet.Text = "产品设置";
this.btnGoodsSet.UseVisualStyleBackColor = true;
this.btnGoodsSet.Click += new System.EventHandler(this.btnGoodsSet_Click);
//
// 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;
//
// 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;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.panel1);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(1041, 587);
this.splitContainer1.SplitterDistance = 99;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 1;
//
// panel1
//
this.panel1.Controls.Add(this.btnGoodsSet);
this.panel1.Controls.Add(this.enableWeight);
this.panel1.Controls.Add(this.panel2);
this.panel1.Controls.Add(this.btnWeightSet);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1039, 97);
this.panel1.TabIndex = 2;
//
// uDataGridView1
//
this.uDataGridView1.AllowUserToAddRows = false;
this.uDataGridView1.AllowUserToDeleteRows = false;
this.uDataGridView1.AllowUserToResizeColumns = false;
this.uDataGridView1.AllowUserToResizeRows = false;
dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7;
this.uDataGridView1.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.uDataGridView1.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.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8;
this.uDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.uDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.dataGridViewTextBoxColumn1,
this.dataGridViewTextBoxColumn2,
this.dataGridViewTextBoxColumn3,
this.dataGridViewTextBoxColumn4,
this.dataGridViewTextBoxColumn5});
this.uDataGridView1.Location = new System.Drawing.Point(3, 108);
this.uDataGridView1.MultiSelect = false;
this.uDataGridView1.Name = "uDataGridView1";
this.uDataGridView1.ReadOnly = true;
this.uDataGridView1.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.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle9;
this.uDataGridView1.RowTemplate.Height = 23;
this.uDataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.uDataGridView1.Size = new System.Drawing.Size(518, 374);
this.uDataGridView1.TabIndex = 2;
//
// dataGridViewTextBoxColumn1
//
this.dataGridViewTextBoxColumn1.DataPropertyName = "ID";
this.dataGridViewTextBoxColumn1.HeaderText = "序号";
this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
this.dataGridViewTextBoxColumn1.ReadOnly = true;
this.dataGridViewTextBoxColumn1.Width = 80;
//
// dataGridViewTextBoxColumn2
//
this.dataGridViewTextBoxColumn2.DataPropertyName = "BarCode";
this.dataGridViewTextBoxColumn2.HeaderText = "条码";
this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
this.dataGridViewTextBoxColumn2.ReadOnly = true;
//
// dataGridViewTextBoxColumn3
//
this.dataGridViewTextBoxColumn3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.dataGridViewTextBoxColumn3.DataPropertyName = "Goods_Name";
this.dataGridViewTextBoxColumn3.HeaderText = "产品";
this.dataGridViewTextBoxColumn3.MinimumWidth = 100;
this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
this.dataGridViewTextBoxColumn3.ReadOnly = true;
//
// dataGridViewTextBoxColumn4
//
this.dataGridViewTextBoxColumn4.DataPropertyName = "JingWeight";
this.dataGridViewTextBoxColumn4.HeaderText = "净重";
this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
this.dataGridViewTextBoxColumn4.ReadOnly = true;
this.dataGridViewTextBoxColumn4.Width = 80;
//
// dataGridViewTextBoxColumn5
//
this.dataGridViewTextBoxColumn5.DataPropertyName = "MaoWeight";
this.dataGridViewTextBoxColumn5.HeaderText = "毛重";
this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
this.dataGridViewTextBoxColumn5.ReadOnly = true;
this.dataGridViewTextBoxColumn5.Width = 80;
//
// ByProductWeightForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1041, 587);
this.Controls.Add(this.splitContainer1);
this.Name = "ByProductWeightForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "副产品称重";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.ByProductWeightForm_Load);
this.tableLayoutPanel1.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label lblGoodsName;
private System.Windows.Forms.Label lblWeight;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label lblNumber;
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.FlowLayoutPanel flpGoods;
private System.Windows.Forms.FlowLayoutPanel flpClass;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.Button btnWeightSet;
private System.Windows.Forms.Label lblChengZhong;
private System.Windows.Forms.Button btnGoodsSet;
private System.Windows.Forms.CheckBox enableWeight;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Panel panel1;
private BWP.WinFormControl.UDataGridView uDataGridView1;
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;
}
}

+ 406
- 0
ByProductWeight/ByProductWeightForm.cs View File

@ -0,0 +1,406 @@
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.Threading.Tasks;
using System.Windows.Forms;
using BO.Utils;
using BWP.WinFormControl.WeightDataFormat;
using ByProductWeight.Rpc;
using ByProductWeight.Rpc.Dto;
namespace ByProductWeight
{
public partial class ByProductWeightForm : Form,IAfterLogin
{
public string RoleName { get { return "副产品计数"; } }
public Form Generate()
{
return this;
}
#region weightNeed
SerialPort weightPort;
private IDataFormat _dataFormat;
private Thread _inQueryThread;
private bool _mainProcessIsRun;
readonly StringBuilder _dataStrBuilder = new StringBuilder();
#endregion
List<ByProductWeightGoodsSet> mSetList ;
BindingList<ByProductWeightRecord> mWeightRecords;
public ByProductWeightForm()
{
InitializeComponent();
uDataGridView1.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 (ByProductWeightContext.Config.RateSet == null)
throw new Exception("请先配置称相关信息");
weightPort.PortName = ByProductWeightContext.Config.ComSet;
weightPort.BaudRate = ByProductWeightContext.Config.RateSet.Value;
weightPort.DataBits = ByProductWeightContext.Config.BitSet.Value;
weightPort.ReadBufferSize = 4096 * 100;
if (!string.IsNullOrEmpty(ByProductWeightContext.Config.Format))
format = "{0:{format}}".Replace("{format}", ByProductWeightContext.Config.Format);
switch (ByProductWeightContext.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 (ByProductWeightContext.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")
{
//doInsertUnSubmit("", decimal.Parse(lblChengZhong.Text));
//todo 这里不需要逻辑 点击存货的时候判断是否在误差范围内
}
}));
}
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)));
//todo 这里不需要逻辑 点击存货的时候判断是否在误差范围内
}
}));
}
}
}
_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 >= ByProductWeightContext.Config.MinWeight && value <= ByProductWeightContext.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 void ByProductWeightForm_Load(object sender, EventArgs e)
{
mWeightRecords = new BindingList<ByProductWeightRecord>();//以后可能取数据库中没做完的,比如做着做着突然断点
RefreshUi();
InitControl();
}
private void InitControl()
{
mSetList =
XmlUtil.DeserializeFromFile<List<ByProductWeightGoodsSet>>(
ByProductWeightGoodsSetForm.ByProductWeightGoodsSetFileName).Where(x => x.IsSelected).ToList();
if (mSetList.Count < 1)
{
return;
}
flpClass.Controls.Clear();
foreach (IGrouping<string, ByProductWeightGoodsSet> grouping in mSetList.GroupBy(x => x.Name))
{
var btnClass = CreateClassButton(grouping.Key);
flpClass.Controls.Add(btnClass);
}
}
private Button CreateClassButton(string text)
{
var btn = new Button();
btn.Text = text;
btn.Click += Btn_Click;
btn.Width = 100;
btn.Height = 60;
return btn;
}
private void Btn_Click(object sender, EventArgs e)
{
var text = (sender as Button).Text;
foreach (Button cbutton in flpClass.Controls)
{
if (cbutton.Text == text)
{
cbutton.BackColor = Color.Aqua;
}
else
{
cbutton.BackColor = SystemColors.Control;
}
}
flpGoods.Controls.Clear();
foreach (ByProductWeightGoodsSet set in mSetList.Where(x => x.Name == text))
{
var btnGoods = CreateGoodsButton(set);
flpGoods.Controls.Add(btnGoods);
}
}
private Button CreateGoodsButton(ByProductWeightGoodsSet set)
{
var btn = new Button();
btn.Text = set.Goods_Name;
btn.Tag = set;
btn.Click += BtnGoods_Click;
btn.Width = 100;
btn.Height = 60;
return btn;
}
private void BtnGoods_Click(object sender, EventArgs e)
{
var btn = sender as Button;
var set = btn.Tag as ByProductWeightGoodsSet;
//todo 打印条码
var weight = 100m;
//添加记录
var record = GetRecordBySet(set, weight);
var id = ByProductWeightRecordRpc.Insert(record);
record.ID = id;
mWeightRecords.Add(record);
RefreshUi();
}
private ByProductWeightRecord GetRecordBySet(ByProductWeightGoodsSet set, decimal maoWeight)
{
var record = new ByProductWeightRecord();
record.Goods_ID = set.Goods_ID;
record.BarCode = "";//todo 条码规则
record.Goods_Name = set.Goods_Name;
record.Goods_Spec = set.Goods_Spec;
record.BiaoShi = "";//todo 标识
record.MaoWeight = maoWeight;
record.PiWeight = 10;
// record.JingWeight = record.MaoWeight - record.PiWeight;
if (set.Goods_MainUnitRatio > 0)
{
record.JingWeight = set.Goods_MainUnitRatio;
}
else
{
record.JingWeight = record.MaoWeight - record.PiWeight;
}
record.CardBarCode = "车条码"; //todo
return record;
}
void RefreshUi()
{
if (mWeightRecords.Count < 1)
{
return;
}
lblGoodsName.Text = mWeightRecords.First().Goods_Name;
lblNumber.Text = mWeightRecords.Count.ToString();
lblWeight.Text = mWeightRecords.Sum(x => x.JingWeight).ToString();
uDataGridView1.DataSource = mWeightRecords;
}
private void btnWeightSet_Click(object sender, EventArgs e)
{
var form = new WeightSettingFrom();
form.ShowDialog();
}
private void btnGoodsSet_Click(object sender, EventArgs e)
{
var f = new ByProductWeightGoodsSetForm();
if (f.ShowDialog() == DialogResult.OK)
{
InitControl();
}
}
}
}

+ 150
- 0
ByProductWeight/ByProductWeightForm.resx View File

@ -0,0 +1,150 @@
<?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="毛重.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="dataGridViewTextBoxColumn1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

+ 14
- 0
ByProductWeight/ByProductWeightGoodsSet.cs View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BO.BO.Dtos;
namespace ByProductWeight
{
public class ByProductWeightGoodsSet : ClientGoodsSetDto
{
public bool IsSelected { get; set; }
}
}

+ 118
- 0
ByProductWeight/ByProductWeightGoodsSetForm.Designer.cs View File

@ -0,0 +1,118 @@
namespace ByProductWeight
{
partial class ByProductWeightGoodsSetForm
{
/// <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.flpGoods = new System.Windows.Forms.FlowLayoutPanel();
this.btnSave = new System.Windows.Forms.Button();
this.flpClass = new System.Windows.Forms.FlowLayoutPanel();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// flpGoods
//
this.flpGoods.Dock = System.Windows.Forms.DockStyle.Fill;
this.flpGoods.Location = new System.Drawing.Point(0, 0);
this.flpGoods.Name = "flpGoods";
this.flpGoods.Size = new System.Drawing.Size(1143, 525);
this.flpGoods.TabIndex = 0;
//
// btnSave
//
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnSave.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSave.Location = new System.Drawing.Point(1001, 3);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(114, 64);
this.btnSave.TabIndex = 1;
this.btnSave.Text = "保存";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// 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.Location = new System.Drawing.Point(3, 3);
this.flpClass.Name = "flpClass";
this.flpClass.Size = new System.Drawing.Size(991, 64);
this.flpClass.TabIndex = 0;
//
// splitContainer1
//
this.splitContainer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.btnSave);
this.splitContainer1.Panel1.Controls.Add(this.flpClass);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.flpGoods);
this.splitContainer1.Size = new System.Drawing.Size(1145, 600);
this.splitContainer1.SplitterDistance = 72;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 1;
//
// ByProductWeightGoodsSetForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1145, 600);
this.Controls.Add(this.splitContainer1);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ByProductWeightGoodsSetForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "产品配置";
this.Load += new System.EventHandler(this.ByProductWeightGoodsSetForm_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.FlowLayoutPanel flpGoods;
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.FlowLayoutPanel flpClass;
private System.Windows.Forms.SplitContainer splitContainer1;
}
}

+ 142
- 0
ByProductWeight/ByProductWeightGoodsSetForm.cs View File

@ -0,0 +1,142 @@
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;
using BO.BO.Dtos;
using BO.Utils;
using BO.Utils.BillRpc;
namespace ByProductWeight
{
public partial class ByProductWeightGoodsSetForm : Form
{
public readonly static string ByProductWeightGoodsSetFileName = "ByProductWeightGoodsSet.xml";
private List<ByProductWeightGoodsSet> mLocaList;
private List<ByProductWeightGoodsSet> mWillDeleteList;
public ByProductWeightGoodsSetForm()
{
InitializeComponent();
}
private void ByProductWeightGoodsSetForm_Load(object sender, EventArgs e)
{
mLocaList = XmlUtil.DeserializeFromFile<List<ByProductWeightGoodsSet>>(ByProductWeightGoodsSetFileName);
var fromRpclist = ClientGoodsSetRpc.GetList();
foreach (ClientGoodsSetDto rpcSet in fromRpclist)
{
var set = new ByProductWeightGoodsSet();
set.Name = rpcSet.Name;
set.Goods_ID = rpcSet.Goods_ID;
set.Goods_Name = rpcSet.Goods_Name;
set.Goods_Code = rpcSet.Goods_Code;
set.Goods_Spec = rpcSet.Goods_Spec;
var fd = mLocaList.FirstOrDefault(x => x.Goods_ID == set.Goods_ID);
if (fd != null)
{
fd.Name = set.Name;
fd.Goods_Name = set.Goods_Name;
fd.Goods_Code = set.Goods_Code;
fd.Goods_Spec = set.Goods_Spec;
}
else
{
mLocaList.Add(set);
}
}
InitControl();
}
private void InitControl()
{
flpClass.Controls.Clear();
foreach (var grouping in mLocaList.GroupBy(x => x.Name))
{
var btn = CreateClassButton(grouping.Key);
flpClass.Controls.Add(btn);
}
}
private Button CreateClassButton(string text)
{
var button = new Button();
button.Text = text;
button.Click += classButton_Click;
button.Width = 100;
button.Height = 60;
return button;
}
private void classButton_Click(object sender, EventArgs e)
{
var btn = sender as Button;
foreach (Button cbutton in flpClass.Controls)
{
if (btn.Text == cbutton.Text)
{
cbutton.BackColor = Color.Aqua;
}
else
{
cbutton.BackColor = SystemColors.Control;
}
}
flpGoods.Controls.Clear();
foreach (ByProductWeightGoodsSet set in mLocaList.Where(x => x.Name == btn.Text))
{
var button = CreateGoodsButton(set);
flpGoods.Controls.Add(button);
}
}
private Button CreateGoodsButton(ByProductWeightGoodsSet set)
{
var btn = new Button();
btn.Text = set.Goods_Name;
btn.Tag = set;
btn.Click += GoodsBtn_Click;
btn.Width = 100;
btn.Height = 60;
if (set.IsSelected)
{
btn.BackColor = Color.Aqua;
}
return btn;
}
private void GoodsBtn_Click(object sender, EventArgs e)
{
var btn = sender as Button;
var set = btn.Tag as ByProductWeightGoodsSet;
if (btn.BackColor == Color.Aqua)
{
set.IsSelected = false;
btn.BackColor = SystemColors.Control;
}
else
{
set.IsSelected = true;
btn.BackColor = Color.Aqua;
}
}
private void btnSave_Click(object sender, EventArgs e)
{
if (mLocaList != null)
{
XmlUtil.SerializerObjToFile(mLocaList, ByProductWeightGoodsSetFileName);
DialogResult = DialogResult.OK;
}
Close();
}
}
}

+ 120
- 0
ByProductWeight/ByProductWeightGoodsSetForm.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>

+ 36
- 0
ByProductWeight/Properties/AssemblyInfo.cs View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ByProductWeight")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ByProductWeight")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("c5696a7d-0beb-474a-a478-fd0543e72abf")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

+ 21
- 0
ByProductWeight/Rpc/ByProductWeightRecordRpc.cs View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ByProductWeight.Rpc.Dto;
using Forks.JsonRpc.Client;
using Newtonsoft.Json;
namespace ByProductWeight.Rpc
{
public class ByProductWeightRecordRpc
{
public static long Insert(ByProductWeightRecord record)
{
var json = JsonConvert.SerializeObject(record);
var id = RpcFacade.Call<long>("/MainSystem/B3ClientService/Rpcs/BillRpc/ByProductWeightRecordRpc/Insert", json);
return id;
}
}
}

+ 22
- 0
ByProductWeight/Rpc/Dto/ByProductWeightRecord.cs View File

@ -0,0 +1,22 @@
using System;
namespace ByProductWeight.Rpc.Dto
{
[Serializable]
public class ByProductWeightRecord
{
public long 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 PiWeight { get; set; }//皮重
public decimal MaoWeight { get; set; }//毛重
public decimal JingWeight { get; set; }//净重
public string CardBarCode { get; set; }//放产品的车的条码
public string BiaoShi { get; set; }//用来记录那个工作台或者哪台触摸屏做的
}
}

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

@ -0,0 +1,291 @@
namespace ByProductWeight
{
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(262, 370);
this.maxInput.Name = "maxInput";
this.maxInput.Size = new System.Drawing.Size(55, 26);
this.maxInput.TabIndex = 86;
this.maxInput.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Number;
//
// minInput
//
this.minInput.Font = new System.Drawing.Font("宋体", 12F);
this.minInput.Location = new System.Drawing.Point(196, 370);
this.minInput.Name = "minInput";
this.minInput.Size = new System.Drawing.Size(55, 26);
this.minInput.TabIndex = 85;
this.minInput.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Number;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("宋体", 15F);
this.label8.Location = new System.Drawing.Point(74, 370);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(109, 20);
this.label8.TabIndex = 84;
this.label8.Text = "有效区间:";
//
// weightReadType
//
this.weightReadType.Font = new System.Drawing.Font("宋体", 15F);
this.weightReadType.FormattingEnabled = true;
this.weightReadType.Location = new System.Drawing.Point(196, 323);
this.weightReadType.Name = "weightReadType";
this.weightReadType.Size = new System.Drawing.Size(121, 28);
this.weightReadType.TabIndex = 83;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("宋体", 15F);
this.label7.Location = new System.Drawing.Point(74, 326);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(109, 20);
this.label7.TabIndex = 82;
this.label7.Text = "读取方式:";
//
// discont
//
this.discont.Font = new System.Drawing.Font("宋体", 14F);
this.discont.Location = new System.Drawing.Point(196, 274);
this.discont.Name = "discont";
this.discont.Size = new System.Drawing.Size(121, 29);
this.discont.TabIndex = 81;
this.discont.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Number;
//
// format
//
this.format.Font = new System.Drawing.Font("宋体", 14F);
this.format.Location = new System.Drawing.Point(196, 226);
this.format.Name = "format";
this.format.Size = new System.Drawing.Size(121, 29);
this.format.TabIndex = 80;
this.format.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Number;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("宋体", 15F);
this.label6.Location = new System.Drawing.Point(74, 283);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(69, 20);
this.label6.TabIndex = 79;
this.label6.Text = "扣重:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("宋体", 15F);
this.label5.Location = new System.Drawing.Point(74, 232);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(109, 20);
this.label5.TabIndex = 78;
this.label5.Text = "显示格式:";
//
// closeBtn
//
this.closeBtn.Font = new System.Drawing.Font("宋体", 15F);
this.closeBtn.Location = new System.Drawing.Point(212, 416);
this.closeBtn.Name = "closeBtn";
this.closeBtn.Size = new System.Drawing.Size(75, 35);
this.closeBtn.TabIndex = 77;
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(106, 416);
this.saveBtn.Name = "saveBtn";
this.saveBtn.Size = new System.Drawing.Size(75, 35);
this.saveBtn.TabIndex = 76;
this.saveBtn.Text = "保存";
this.saveBtn.UseVisualStyleBackColor = true;
this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click);
//
// bitSet
//
this.bitSet.Font = new System.Drawing.Font("宋体", 15F);
this.bitSet.FormattingEnabled = true;
this.bitSet.Location = new System.Drawing.Point(196, 179);
this.bitSet.Name = "bitSet";
this.bitSet.Size = new System.Drawing.Size(121, 28);
this.bitSet.TabIndex = 73;
//
// rateSet
//
this.rateSet.Font = new System.Drawing.Font("宋体", 15F);
this.rateSet.FormattingEnabled = true;
this.rateSet.Location = new System.Drawing.Point(196, 127);
this.rateSet.Name = "rateSet";
this.rateSet.Size = new System.Drawing.Size(121, 28);
this.rateSet.TabIndex = 74;
//
// comSet
//
this.comSet.Font = new System.Drawing.Font("宋体", 15F);
this.comSet.FormattingEnabled = true;
this.comSet.Location = new System.Drawing.Point(196, 77);
this.comSet.Name = "comSet";
this.comSet.Size = new System.Drawing.Size(121, 28);
this.comSet.TabIndex = 75;
//
// weightSet
//
this.weightSet.Font = new System.Drawing.Font("宋体", 15F);
this.weightSet.FormattingEnabled = true;
this.weightSet.Location = new System.Drawing.Point(196, 29);
this.weightSet.Name = "weightSet";
this.weightSet.Size = new System.Drawing.Size(121, 28);
this.weightSet.TabIndex = 72;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("宋体", 15F);
this.label4.Location = new System.Drawing.Point(74, 182);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(89, 20);
this.label4.TabIndex = 71;
this.label4.Text = "数据位:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 15F);
this.label3.Location = new System.Drawing.Point(74, 130);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(89, 20);
this.label3.TabIndex = 70;
this.label3.Text = "波特率:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 15F);
this.label2.Location = new System.Drawing.Point(74, 80);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(89, 20);
this.label2.TabIndex = 69;
this.label2.Text = "端口号:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 15F);
this.label1.Location = new System.Drawing.Point(74, 32);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(89, 20);
this.label1.TabIndex = 68;
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
ByProductWeight/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 ByProductWeight
{
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(ByProductWeightContext.Config.WeightSet))
weightSet.SelectedIndex = weight.IndexOf(ByProductWeightContext.Config.WeightSet);
else
weightSet.SelectedIndex = 0;
if (!string.IsNullOrEmpty(ByProductWeightContext.Config.ComSet))
comSet.SelectedIndex = com.IndexOf(ByProductWeightContext.Config.ComSet);
else
comSet.SelectedIndex = 0;
if (ByProductWeightContext.Config.RateSet.HasValue)
rateSet.SelectedIndex = rate.IndexOf(ByProductWeightContext.Config.RateSet.ToString());
else
rateSet.SelectedIndex = 2;
if (ByProductWeightContext.Config.BitSet.HasValue)
bitSet.SelectedIndex = bit.IndexOf(ByProductWeightContext.Config.BitSet.ToString());
else
bitSet.SelectedIndex = 3;
if (string.IsNullOrEmpty(ByProductWeightContext.Config.Format))
format.Text = "0.00";
else
format.Text = ByProductWeightContext.Config.Format;
if (ByProductWeightContext.Config.Discont == null)
discont.Text = "0.00";
else
discont.Text = ByProductWeightContext.Config.Discont.ToString();
weightReadType.SelectedIndex = ByProductWeightContext.Config.WeightType;
minInput.Text = ByProductWeightContext.Config.MinWeight.ToString();
maxInput.Text = ByProductWeightContext.Config.MaxWeight.ToString();
}
private void saveBtn_Click(object sender, EventArgs e)
{
ByProductWeightContext.Config.WeightSet = weight[this.weightSet.SelectedIndex];
ByProductWeightContext.Config.ComSet = com[this.comSet.SelectedIndex];
ByProductWeightContext.Config.RateSet = int.Parse(rate[this.rateSet.SelectedIndex]);
ByProductWeightContext.Config.BitSet = int.Parse(bit[this.bitSet.SelectedIndex]);
ByProductWeightContext.Config.Format = format.Text;
ByProductWeightContext.Config.WeightType = weightReadType.SelectedIndex;
if (ByProductWeightContext.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("连续发送时 必须输入有效区间");
ByProductWeightContext.Config.MinWeight = min;
ByProductWeightContext.Config.MaxWeight = max;
}
if (!string.IsNullOrEmpty(discont.Text))
{
decimal v;
if (decimal.TryParse(discont.Text, out v))
ByProductWeightContext.Config.Discont = v;
else
throw new Exception("扣重格式输入不正确");
}
else
ByProductWeightContext.Config.Discont = 0;
ByProductWeightContext.Save();
MessageBox.Show("保存成功!");
}
private void closeBtn_Click(object sender, EventArgs e)
{
Close();
}
}
}

+ 120
- 0
ByProductWeight/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>

+ 1
- 0
ByProductWeight/副产品称重.txt View File

@ -0,0 +1 @@


+ 39
- 36
SegmentationWeight/SegmentationWeightForm.Designer.cs View File

@ -28,9 +28,9 @@
/// </summary>
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 dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.panel1 = new System.Windows.Forms.Panel();
this.btnGoodsSet = new System.Windows.Forms.Button();
@ -84,7 +84,7 @@
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(1041, 547);
this.splitContainer1.Size = new System.Drawing.Size(1041, 587);
this.splitContainer1.SplitterDistance = 99;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 0;
@ -104,7 +104,7 @@
// btnGoodsSet
//
this.btnGoodsSet.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnGoodsSet.Location = new System.Drawing.Point(461, 23);
this.btnGoodsSet.Location = new System.Drawing.Point(437, 23);
this.btnGoodsSet.Name = "btnGoodsSet";
this.btnGoodsSet.Size = new System.Drawing.Size(114, 63);
this.btnGoodsSet.TabIndex = 34;
@ -154,6 +154,7 @@
this.btnWeightSet.TabIndex = 0;
this.btnWeightSet.Text = "称设置";
this.btnWeightSet.UseVisualStyleBackColor = true;
this.btnWeightSet.Click += new System.EventHandler(this.btnWeightSet_Click);
//
// splitContainer2
//
@ -172,8 +173,8 @@
//
this.splitContainer2.Panel2.Controls.Add(this.uDataGridView1);
this.splitContainer2.Panel2.Controls.Add(this.tableLayoutPanel1);
this.splitContainer2.Size = new System.Drawing.Size(1041, 447);
this.splitContainer2.SplitterDistance = 553;
this.splitContainer2.Size = new System.Drawing.Size(1041, 487);
this.splitContainer2.SplitterDistance = 556;
this.splitContainer2.SplitterWidth = 1;
this.splitContainer2.TabIndex = 0;
//
@ -181,18 +182,20 @@
//
this.flpGoods.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.flpGoods.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.flpGoods.Location = new System.Drawing.Point(4, 87);
this.flpGoods.Name = "flpGoods";
this.flpGoods.Size = new System.Drawing.Size(541, 355);
this.flpGoods.Size = new System.Drawing.Size(541, 395);
this.flpGoods.TabIndex = 1;
//
// 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(4, 4);
this.flpClass.Name = "flpClass";
this.flpClass.Size = new System.Drawing.Size(544, 76);
this.flpClass.Size = new System.Drawing.Size(547, 76);
this.flpClass.TabIndex = 0;
//
// uDataGridView1
@ -201,20 +204,20 @@
this.uDataGridView1.AllowUserToDeleteRows = false;
this.uDataGridView1.AllowUserToResizeColumns = false;
this.uDataGridView1.AllowUserToResizeRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle13.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13;
this.uDataGridView1.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.uDataGridView1.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle14.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14;
this.uDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.uDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.,
@ -227,12 +230,12 @@
this.uDataGridView1.Name = "uDataGridView1";
this.uDataGridView1.ReadOnly = true;
this.uDataGridView1.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;
dataGridViewCellStyle15.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle15;
this.uDataGridView1.RowTemplate.Height = 23;
this.uDataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.uDataGridView1.Size = new System.Drawing.Size(483, 334);
this.uDataGridView1.Size = new System.Drawing.Size(483, 374);
this.uDataGridView1.TabIndex = 1;
//
// 序号
@ -283,7 +286,7 @@
this.tableLayoutPanel1.ColumnCount = 3;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 65.90909F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 34.09091F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 86F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 88F));
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.label2, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.label3, 2, 0);
@ -295,7 +298,7 @@
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 53.57143F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 46.42857F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(486, 98);
this.tableLayoutPanel1.Size = new System.Drawing.Size(479, 98);
this.tableLayoutPanel1.TabIndex = 0;
//
// label1
@ -305,7 +308,7 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.Location = new System.Drawing.Point(4, 1);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(254, 50);
this.label1.Size = new System.Drawing.Size(249, 50);
this.label1.TabIndex = 0;
this.label1.Text = "产品";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -315,9 +318,9 @@
this.label2.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.label2.Location = new System.Drawing.Point(265, 1);
this.label2.Location = new System.Drawing.Point(260, 1);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(129, 50);
this.label2.Size = new System.Drawing.Size(125, 50);
this.label2.TabIndex = 0;
this.label2.Text = "数量";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -327,9 +330,9 @@
this.label3.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.label3.Location = new System.Drawing.Point(401, 1);
this.label3.Location = new System.Drawing.Point(392, 1);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(81, 50);
this.label3.Size = new System.Drawing.Size(83, 50);
this.label3.TabIndex = 0;
this.label3.Text = "重量";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -341,7 +344,7 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.lblGoodsName.Location = new System.Drawing.Point(4, 52);
this.lblGoodsName.Name = "lblGoodsName";
this.lblGoodsName.Size = new System.Drawing.Size(254, 45);
this.lblGoodsName.Size = new System.Drawing.Size(249, 45);
this.lblGoodsName.TabIndex = 0;
this.lblGoodsName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
@ -350,9 +353,9 @@
this.lblNumber.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.lblNumber.Location = new System.Drawing.Point(265, 52);
this.lblNumber.Location = new System.Drawing.Point(260, 52);
this.lblNumber.Name = "lblNumber";
this.lblNumber.Size = new System.Drawing.Size(129, 45);
this.lblNumber.Size = new System.Drawing.Size(125, 45);
this.lblNumber.TabIndex = 0;
this.lblNumber.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
@ -361,9 +364,9 @@
this.lblWeight.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.lblWeight.Location = new System.Drawing.Point(401, 52);
this.lblWeight.Location = new System.Drawing.Point(392, 52);
this.lblWeight.Name = "lblWeight";
this.lblWeight.Size = new System.Drawing.Size(81, 45);
this.lblWeight.Size = new System.Drawing.Size(83, 45);
this.lblWeight.TabIndex = 0;
this.lblWeight.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
@ -371,7 +374,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1041, 547);
this.ClientSize = new System.Drawing.Size(1041, 587);
this.Controls.Add(this.splitContainer1);
this.MinimizeBox = false;
this.Name = "SegmentationWeightForm";


+ 8
- 3
SegmentationWeight/SegmentationWeightForm.cs View File

@ -29,8 +29,7 @@ namespace SegmentationWeight
readonly StringBuilder _dataStrBuilder = new StringBuilder();
#endregion
List<SegmentationWeightGoodSet> mSetList = XmlUtil.DeserializeFromFile<List<SegmentationWeightGoodSet>>(SegmentationWeightGoodsSetForm.SegmentationWeightGoodsSetFileName).Where(x => x.IsSelected).ToList();
private List<SegmentationWeightGoodSet> mSetList;
BindingList<SegmentationWeightRecord> mWeightRecords;
@ -275,7 +274,7 @@ namespace SegmentationWeight
private void InitControl()
{
mSetList = XmlUtil.DeserializeFromFile<List<SegmentationWeightGoodSet>>(SegmentationWeightGoodsSetForm.SegmentationWeightGoodsSetFileName).Where(x => x.IsSelected).ToList();
if (mSetList.Count < 1)
{
return;
@ -396,5 +395,11 @@ namespace SegmentationWeight
{
return this;
}
private void btnWeightSet_Click(object sender, EventArgs e)
{
var form=new WeightSettingFrom();
form.ShowDialog();
}
}
}

+ 17
- 4
WeighAndGrading/GradeFrom.cs View File

@ -1239,8 +1239,20 @@ namespace WeighAndGrading
png = "working.png";
var imgPath = Path.Combine(Application.StartupPath, "BWP.WinFormControl.dll");
var s = Assembly.LoadFile(imgPath).GetManifestResourceStream("BWP.WinFormControl.Images." + png);
statePic.Image = Image.FromStream(s);
statePic.Refresh();
if (this.InvokeRequired)
{
this.BeginInvoke(new Action(() =>
{
statePic.Image = Image.FromStream(s);
statePic.Refresh();
}));
}
else
{
statePic.Image = Image.FromStream(s);
statePic.Refresh();
}
last = connection;
}
@ -1267,7 +1279,7 @@ namespace WeighAndGrading
{
while (true)
{
this.Invoke(new InvokeHandler(delegate ()
// this.Invoke(new InvokeHandler(delegate ()
{
VerifyConnection();
if (connection)
@ -1284,7 +1296,8 @@ namespace WeighAndGrading
File.WriteAllText(string.Format("{0:yyyyMMddHHmmss}log.txt", DateTime.Now), "错误:" + ex.Message + " \n详细信息:" + ex.StackTrace);
}
}
}));
}
// ));
Thread.Sleep(2000);
}
}


Loading…
Cancel
Save