Browse Source

分割 + 测试winform

master
wugang 8 years ago
parent
commit
f778190f3b
28 changed files with 1174 additions and 643 deletions
  1. +8
    -2
      B3ButcherManageClient.sln
  2. +3
    -9
      BO/BarCodeScan/BardCodeHook.cs
  3. +3
    -1
      BO/Utils/AfterLoginUtil.cs
  4. +1
    -0
      BO/Utils/ServerUrlConfig.cs
  5. +11
    -32
      BO/Utils/UrlUtil.cs
  6. +3
    -3
      ButcherManageClient/Login.cs
  7. +29
    -5
      ButcherManageClient/SettingForm.Designer.cs
  8. +2
    -0
      ButcherManageClient/SettingForm.cs
  9. +25
    -25
      ByProductWeight/ByProductWeightForm.Designer.cs
  10. +1
    -0
      SegmentationWeight/SegmentationWeight.csproj
  11. +111
    -110
      SegmentationWeight/SegmentationWeightForm.Designer.cs
  12. +34
    -2
      SegmentationWeight/SegmentationWeightForm.cs
  13. +60
    -0
      SegmentationWeight/SegmentationWeightPrint.cs
  14. +54
    -154
      TrunksIousOutInStore/TrunksIousOutInStoreForm.Designer.cs
  15. +195
    -288
      TrunksIousOutInStore/TrunksIousOutInStoreForm.cs
  16. +3
    -9
      TrunksIousOutInStore/TrunksIousOutInStoreForm.resx
  17. +3
    -3
      WeighAndGrading/GradeFrom.cs
  18. +6
    -0
      WinFormTest/App.config
  19. +63
    -0
      WinFormTest/Form1.Designer.cs
  20. +57
    -0
      WinFormTest/Form1.cs
  21. +120
    -0
      WinFormTest/Form1.resx
  22. +22
    -0
      WinFormTest/Program.cs
  23. +36
    -0
      WinFormTest/Properties/AssemblyInfo.cs
  24. +71
    -0
      WinFormTest/Properties/Resources.Designer.cs
  25. +117
    -0
      WinFormTest/Properties/Resources.resx
  26. +30
    -0
      WinFormTest/Properties/Settings.Designer.cs
  27. +7
    -0
      WinFormTest/Properties/Settings.settings
  28. +99
    -0
      WinFormTest/WinFormTest.csproj

+ 8
- 2
B3ButcherManageClient.sln View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BO", "BO\BO.csproj", "{8968F14A-C7C7-4751-96CE-B114FBFD65EF}"
EndProject
@ -37,6 +37,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Distribution", "Distributio
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropPigReOrder", "DropPigReOrder\DropPigReOrder.csproj", "{031BDA81-6DCE-41CD-B8FB-D5334A4940B0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormTest", "WinFormTest\WinFormTest.csproj", "{E9831F50-FD30-465C-9BF1-D3C9C415EF5B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -109,6 +111,10 @@ Global
{031BDA81-6DCE-41CD-B8FB-D5334A4940B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{031BDA81-6DCE-41CD-B8FB-D5334A4940B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{031BDA81-6DCE-41CD-B8FB-D5334A4940B0}.Release|Any CPU.Build.0 = Release|Any CPU
{E9831F50-FD30-465C-9BF1-D3C9C415EF5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E9831F50-FD30-465C-9BF1-D3C9C415EF5B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9831F50-FD30-465C-9BF1-D3C9C415EF5B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E9831F50-FD30-465C-9BF1-D3C9C415EF5B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE


+ 3
- 9
BO/BarCodeScan/BardCodeHook.cs View File

@ -106,15 +106,6 @@ namespace BO
{
barCode.VirtKey = msg.message & 0xff;//虚拟吗
barCode.ScanCode = msg.paramL & 0xff;//扫描码
StringBuilder strKeyName = new StringBuilder(225);
if (GetKeyNameText(barCode.ScanCode * 65536, strKeyName, 255) > 0)
{
barCode.KeyName = strKeyName.ToString().Trim(new char[] { ' ', '\0' });
}
else
{
barCode.KeyName = "";
}
byte[] kbArray = new byte[256];
uint uKey = 0;
GetKeyboardState(kbArray);
@ -159,6 +150,8 @@ namespace BO
barCode.IsValid = true;
sbBarCode.Remove(0, sbBarCode.Length);
}
Debug.Print(sbBarCode.ToString()+ " "+ barCode.Chr.ToString());
sbBarCode.Append(barCode.Chr.ToString());
}
@ -177,6 +170,7 @@ namespace BO
BarCodeEvent(barCode);//触发事件
barCode.BarCode = "";


+ 3
- 1
BO/Utils/AfterLoginUtil.cs View File

@ -24,8 +24,10 @@ namespace BO.Utils
new Tuple<string,string>("验质员",@"C:\BwpB3Project\src\B3ButcherManageClient\QualityAndOrder\bin\Debug\QualityAndOrder"),
new Tuple<string,string>("定级员",@"C:\BwpB3Project\src\B3ButcherManageClient\WeighAndGrading\bin\Debug\WeighAndGrading"),
new Tuple<string,string>("窒晕员",@"C:\BwpB3Project\src\B3ButcherManageClient\OrderConfirm\bin\Debug\OrderConfirm"),
new Tuple<string,string>("胴体白条出入库",@"C:\B3\src\B3ButcherManageClient\TrunksIousOutInStore\bin\Debug\TrunksIousOutInStore"),
new Tuple<string,string>("掉猪处理员",@"C:\BwpB3Project\src\B3ButcherManageClient\DropPigReOrder\bin\Debug\DropPigReOrder"),
new Tuple<string,string>("配货员",@"D:\BWP\BWPB3\src\B3ButcherManageClient\Distribution\bin\Debug\Distribution")
new Tuple<string,string>("配货员",@"D:\BWP\BWPB3\src\B3ButcherManageClient\Distribution\bin\Debug\Distribution"),
new Tuple<string,string>("分割称重",@"C:\B3\src\B3ButcherManageClient\SegmentationWeight\bin\Debug\SegmentationWeight")
};
#else
static List<Tuple<string, string>> roleToAssemblies = new List<Tuple<string, string>>()


+ 1
- 0
BO/Utils/ServerUrlConfig.cs View File

@ -11,5 +11,6 @@ namespace BO.Utils
public string ServerUrl { get; set; }
public string OfflineSqlConnection { get; set; }
public string OutAddress { get; set; }//外网地址,追溯用的
}
}

+ 11
- 32
BO/Utils/UrlUtil.cs View File

@ -17,56 +17,35 @@ namespace BO.Utils
if (barCode.Contains("?") && barCode.ToLower().Contains("http"))
{
barCode = barCode.Replace("http://www.bwpsoft.com?code=", "");
barCode = barCode.Replace(ButcherAppContext.Context.UrlConfig.OutAddress+"?code=", "");
var andIndex = barCode.IndexOf("&", StringComparison.Ordinal);
barCode = barCode.Substring(0, andIndex);
}
return barCode.Trim();
// if (barCode.Contains("?") && barCode.ToLower().Contains("http"))
// {
// Uri uri = new Uri(barCode);
// string queryString = uri.Query;
// NameValueCollection col = GetQueryString(queryString);
// string code = col["code"];
//
// return code;
// }
// else
// {
// return barCode;
// }
}
public static string GetGoodsName(string barCode)
{
//如果是链接
if (barCode.Contains("name="))
{
var index = barCode.IndexOf("name=", StringComparison.Ordinal);
barCode = barCode.Substring(index+5);
return barCode.Trim();
var name= barCode.Trim();
if (name == "qpbt")
{
return "去皮白条";
}
if (name == "dpbt")
{
return "带皮白条";
}
return name;
}
return "";
// if (barCode.Contains("?") && barCode.ToLower().Contains("http"))
// {
// Uri uri = new Uri(barCode);
// string queryString = uri.Query;
// NameValueCollection col = GetQueryString(queryString);
// string name = col["name"];
// return name;
// }
// else
// {
// return "";
// }
}
private static NameValueCollection GetQueryString(string queryString)


+ 3
- 3
ButcherManageClient/Login.cs View File

@ -33,7 +33,7 @@ namespace ButcherManageClient
{
InitializeComponent();
userNameTxt.Text = ButcherAppContext.Context.UserConfig.UserName;
pwdTxt.Text = "123";
pwdTxt.Text = "";
}
private void settingBtn_Click(object sender, EventArgs e)
@ -65,8 +65,8 @@ namespace ButcherManageClient
throw new Exception("离线状态请保持与上次用户名一致");
ButcherAppContext.Context.UserConfig.Connection = false;
}
var form = AfterLoginUtil.CreateForm(ButcherAppContext.Context.UserConfig.Role);
// var form = AfterLoginUtil.CreateForm("配货员");
// var form = AfterLoginUtil.CreateForm(ButcherAppContext.Context.UserConfig.Role);
var form = AfterLoginUtil.CreateForm("分割称重");
if (form == null)
throw new Exception("权限不符");
form.FormClosing += delegate { SubFormClosing(); };


+ 29
- 5
ButcherManageClient/SettingForm.Designer.cs View File

@ -34,12 +34,14 @@
this.label1 = new System.Windows.Forms.Label();
this.offlineSqlConInput = new BWP.WinFormControl.UTextBoxWithPad();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.txtOutAddress = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// cancelBtn
//
this.cancelBtn.Font = new System.Drawing.Font("宋体", 20F);
this.cancelBtn.Location = new System.Drawing.Point(238, 164);
this.cancelBtn.Location = new System.Drawing.Point(236, 245);
this.cancelBtn.Name = "cancelBtn";
this.cancelBtn.Size = new System.Drawing.Size(81, 53);
this.cancelBtn.TabIndex = 7;
@ -50,7 +52,7 @@
// saveBtn
//
this.saveBtn.Font = new System.Drawing.Font("宋体", 20F);
this.saveBtn.Location = new System.Drawing.Point(97, 164);
this.saveBtn.Location = new System.Drawing.Point(95, 245);
this.saveBtn.Name = "saveBtn";
this.saveBtn.Size = new System.Drawing.Size(81, 53);
this.saveBtn.TabIndex = 6;
@ -63,7 +65,7 @@
this.uTextBoxWithPad1.Font = new System.Drawing.Font("宋体", 15F);
this.uTextBoxWithPad1.Location = new System.Drawing.Point(140, 41);
this.uTextBoxWithPad1.Name = "uTextBoxWithPad1";
this.uTextBoxWithPad1.Size = new System.Drawing.Size(246, 30);
this.uTextBoxWithPad1.Size = new System.Drawing.Size(363, 30);
this.uTextBoxWithPad1.TabIndex = 5;
this.uTextBoxWithPad1.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Normal;
//
@ -82,7 +84,7 @@
this.offlineSqlConInput.Font = new System.Drawing.Font("宋体", 15F);
this.offlineSqlConInput.Location = new System.Drawing.Point(140, 106);
this.offlineSqlConInput.Name = "offlineSqlConInput";
this.offlineSqlConInput.Size = new System.Drawing.Size(246, 30);
this.offlineSqlConInput.Size = new System.Drawing.Size(363, 30);
this.offlineSqlConInput.TabIndex = 9;
this.offlineSqlConInput.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Normal;
//
@ -96,13 +98,33 @@
this.label2.TabIndex = 8;
this.label2.Text = "离线数据库:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 15F);
this.label3.Location = new System.Drawing.Point(38, 170);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(109, 20);
this.label3.TabIndex = 8;
this.label3.Text = "外网地址:";
//
// txtOutAddress
//
this.txtOutAddress.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtOutAddress.Location = new System.Drawing.Point(140, 170);
this.txtOutAddress.Name = "txtOutAddress";
this.txtOutAddress.Size = new System.Drawing.Size(363, 26);
this.txtOutAddress.TabIndex = 10;
//
// SettingForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(404, 242);
this.ClientSize = new System.Drawing.Size(533, 355);
this.ControlBox = false;
this.Controls.Add(this.txtOutAddress);
this.Controls.Add(this.offlineSqlConInput);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.cancelBtn);
this.Controls.Add(this.saveBtn);
@ -124,5 +146,7 @@
private System.Windows.Forms.Label label1;
private BWP.WinFormControl.UTextBoxWithPad offlineSqlConInput;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtOutAddress;
}
}

+ 2
- 0
ButcherManageClient/SettingForm.cs View File

@ -20,6 +20,7 @@ namespace ButcherManageClient
InitializeComponent();
uTextBoxWithPad1.Text = ButcherAppContext.Context.UrlConfig.ServerUrl;
offlineSqlConInput.Text = ButcherAppContext.Context.UrlConfig.OfflineSqlConnection;
txtOutAddress.Text = ButcherAppContext.Context.UrlConfig.OutAddress;
if (string.IsNullOrEmpty(offlineSqlConInput.Text))
offlineSqlConInput.Text = "Server=localhost;Database=LocalClientService;Integrated Security=true;Language=Simplified Chinese;";
mInited = rpcFacadeInited;
@ -37,6 +38,7 @@ namespace ButcherManageClient
throw new Exception("请先设置服务器地址");
ButcherAppContext.Context.UrlConfig.ServerUrl = uri;
ButcherAppContext.Context.UrlConfig.OfflineSqlConnection = offlineSqlConInput.Text.Trim();
ButcherAppContext.Context.UrlConfig.OutAddress = txtOutAddress.Text.Trim();
ButcherAppContext.Context.Save();
if (mInited)


+ 25
- 25
ByProductWeight/ByProductWeightForm.Designer.cs View File

@ -28,9 +28,9 @@
/// </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();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
@ -92,7 +92,7 @@
| 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.Size = new System.Drawing.Size(138, 50);
this.label2.TabIndex = 0;
this.label2.Text = "数量";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -102,9 +102,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(431, 1);
this.label3.Location = new System.Drawing.Point(430, 1);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(83, 50);
this.label3.Size = new System.Drawing.Size(87, 50);
this.label3.TabIndex = 0;
this.label3.Text = "重量";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -125,9 +125,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(431, 52);
this.lblWeight.Location = new System.Drawing.Point(430, 52);
this.lblWeight.Name = "lblWeight";
this.lblWeight.Size = new System.Drawing.Size(83, 45);
this.lblWeight.Size = new System.Drawing.Size(87, 45);
this.lblWeight.TabIndex = 0;
this.lblWeight.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
@ -139,7 +139,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, 88F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 92F));
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.label2, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.label3, 2, 0);
@ -151,7 +151,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(518, 98);
this.tableLayoutPanel1.Size = new System.Drawing.Size(521, 98);
this.tableLayoutPanel1.TabIndex = 0;
//
// lblNumber
@ -161,7 +161,7 @@
| 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.Size = new System.Drawing.Size(138, 45);
this.lblNumber.TabIndex = 0;
this.lblNumber.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
@ -341,20 +341,20 @@
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;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
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;
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;
this.uDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.uDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.dataGridViewTextBoxColumn1,
@ -367,12 +367,12 @@
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;
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(518, 374);
this.uDataGridView1.Size = new System.Drawing.Size(521, 374);
this.uDataGridView1.TabIndex = 2;
//
// dataGridViewTextBoxColumn1


+ 1
- 0
SegmentationWeight/SegmentationWeight.csproj View File

@ -67,6 +67,7 @@
<Compile Include="SegmentationWeightGoodsSetForm.Designer.cs">
<DependentUpon>SegmentationWeightGoodsSetForm.cs</DependentUpon>
</Compile>
<Compile Include="SegmentationWeightPrint.cs" />
<Compile Include="WeightSettingFrom.cs">
<SubType>Form</SubType>
</Compile>


+ 111
- 110
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 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();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.panel1 = new System.Windows.Forms.Panel();
this.btnGoodsSet = new System.Windows.Forms.Button();
@ -41,6 +41,12 @@
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.flpGoods = new System.Windows.Forms.FlowLayoutPanel();
this.flpClass = new System.Windows.Forms.FlowLayoutPanel();
this.uDataGridView1 = 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.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
@ -48,12 +54,6 @@
this.lblGoodsName = new System.Windows.Forms.Label();
this.lblNumber = new System.Windows.Forms.Label();
this.lblWeight = new System.Windows.Forms.Label();
this.uDataGridView1 = 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();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@ -64,8 +64,8 @@
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
@ -91,7 +91,6 @@
//
// 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);
@ -103,10 +102,11 @@
//
// 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(437, 23);
this.btnGoodsSet.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnGoodsSet.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnGoodsSet.Location = new System.Drawing.Point(416, 16);
this.btnGoodsSet.Name = "btnGoodsSet";
this.btnGoodsSet.Size = new System.Drawing.Size(114, 63);
this.btnGoodsSet.Size = new System.Drawing.Size(95, 50);
this.btnGoodsSet.TabIndex = 34;
this.btnGoodsSet.Text = "产品设置";
this.btnGoodsSet.UseVisualStyleBackColor = true;
@ -165,6 +165,7 @@
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.btnGoodsSet);
this.splitContainer2.Panel1.Controls.Add(this.flpGoods);
this.splitContainer2.Panel1.Controls.Add(this.flpClass);
//
@ -173,7 +174,7 @@
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 = 556;
this.splitContainer2.SplitterDistance = 517;
this.splitContainer2.SplitterWidth = 1;
this.splitContainer2.TabIndex = 0;
//
@ -185,7 +186,7 @@
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, 395);
this.flpGoods.Size = new System.Drawing.Size(507, 395);
this.flpGoods.TabIndex = 1;
//
// flpClass
@ -195,9 +196,89 @@
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(547, 76);
this.flpClass.Size = new System.Drawing.Size(392, 76);
this.flpClass.TabIndex = 0;
//
// uDataGridView1
//
this.uDataGridView1.AllowUserToAddRows = false;
this.uDataGridView1.AllowUserToDeleteRows = false;
this.uDataGridView1.AllowUserToResizeColumns = false;
this.uDataGridView1.AllowUserToResizeRows = false;
dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4;
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;
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.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5;
this.uDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.uDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.,
this.,
this.,
this.,
this.});
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;
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.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle6;
this.uDataGridView1.RowTemplate.Height = 23;
this.uDataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.uDataGridView1.Size = new System.Drawing.Size(533, 374);
this.uDataGridView1.TabIndex = 1;
//
// 序号
//
this..DataPropertyName = "ID";
this..HeaderText = "序号";
this..Name = "序号";
this..ReadOnly = true;
this..Width = 80;
//
// 条码
//
this..DataPropertyName = "BarCode";
this..HeaderText = "条码";
this..Name = "条码";
this..ReadOnly = true;
//
// 产品
//
this..AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this..DataPropertyName = "Goods_Name";
this..HeaderText = "产品";
this..MinimumWidth = 100;
this..Name = "产品";
this..ReadOnly = true;
//
// 净重
//
this..DataPropertyName = "JingWeight";
this..HeaderText = "净重";
this..Name = "净重";
this..ReadOnly = true;
this..Width = 80;
//
// 毛重
//
this..DataPropertyName = "MaoWeight";
this..HeaderText = "毛重";
this..Name = "毛重";
this..ReadOnly = true;
this..Width = 80;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@ -206,7 +287,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, 96F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 106F));
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.label2, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.label3, 2, 0);
@ -218,7 +299,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(482, 98);
this.tableLayoutPanel1.Size = new System.Drawing.Size(529, 98);
this.tableLayoutPanel1.TabIndex = 0;
//
// label1
@ -228,7 +309,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(245, 50);
this.label1.Size = new System.Drawing.Size(270, 50);
this.label1.TabIndex = 0;
this.label1.Text = "产品";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -238,9 +319,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(256, 1);
this.label2.Location = new System.Drawing.Point(281, 1);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(124, 50);
this.label2.Size = new System.Drawing.Size(136, 50);
this.label2.TabIndex = 0;
this.label2.Text = "数量";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -250,9 +331,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(387, 1);
this.label3.Location = new System.Drawing.Point(424, 1);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(91, 50);
this.label3.Size = new System.Drawing.Size(101, 50);
this.label3.TabIndex = 0;
this.label3.Text = "重量";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -264,7 +345,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(245, 45);
this.lblGoodsName.Size = new System.Drawing.Size(270, 45);
this.lblGoodsName.TabIndex = 0;
this.lblGoodsName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
@ -273,9 +354,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(256, 52);
this.lblNumber.Location = new System.Drawing.Point(281, 52);
this.lblNumber.Name = "lblNumber";
this.lblNumber.Size = new System.Drawing.Size(124, 45);
this.lblNumber.Size = new System.Drawing.Size(136, 45);
this.lblNumber.TabIndex = 0;
this.lblNumber.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
@ -284,92 +365,12 @@
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(387, 52);
this.lblWeight.Location = new System.Drawing.Point(424, 52);
this.lblWeight.Name = "lblWeight";
this.lblWeight.Size = new System.Drawing.Size(91, 45);
this.lblWeight.Size = new System.Drawing.Size(101, 45);
this.lblWeight.TabIndex = 0;
this.lblWeight.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// uDataGridView1
//
this.uDataGridView1.AllowUserToAddRows = false;
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;
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;
this.uDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.uDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.,
this.,
this.,
this.,
this.});
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;
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(486, 374);
this.uDataGridView1.TabIndex = 1;
//
// 序号
//
this..DataPropertyName = "ID";
this..HeaderText = "序号";
this..Name = "序号";
this..ReadOnly = true;
this..Width = 80;
//
// 条码
//
this..DataPropertyName = "BarCode";
this..HeaderText = "条码";
this..Name = "条码";
this..ReadOnly = true;
//
// 产品
//
this..AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this..DataPropertyName = "Goods_Name";
this..HeaderText = "产品";
this..MinimumWidth = 100;
this..Name = "产品";
this..ReadOnly = true;
//
// 净重
//
this..DataPropertyName = "JingWeight";
this..HeaderText = "净重";
this..Name = "净重";
this..ReadOnly = true;
this..Width = 80;
//
// 毛重
//
this..DataPropertyName = "MaoWeight";
this..HeaderText = "毛重";
this..Name = "毛重";
this..ReadOnly = true;
this..Width = 80;
//
// SegmentationWeightForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@ -394,8 +395,8 @@
this.splitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).EndInit();
this.tableLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}


+ 34
- 2
SegmentationWeight/SegmentationWeightForm.cs View File

@ -349,10 +349,42 @@ namespace SegmentationWeight
record.ID = id;
mWeightRecords.Add(record);
RefreshUi();
}
var entity = CreatePrintEntity("5号里脊肉");
SegmentationWeightPrint.Print(entity);
}
PrintEntity CreatePrintEntity(string goodsName)
{
var entity = new PrintEntity();
entity.AccountingUnit_Name = "青岛万福集团股份有限公司";
entity.Goods_Name = goodsName;
entity.Date = DateTime.Today;
entity.Checker = "";
entity.StoreCondition = "0-4℃";
entity.Place = "青岛莱西市";
entity.TelNumber = "0532-88488888";
int maxindex=0;
// if (index == null)
// {
//// maxindex = LocalGradeAndWeightBL.GetTodayTotalCount(butcherTimeInput.Date.Value);
// maxindex++;
// }
// else
// {
// maxindex = index.Value;
// }
string indexCode = maxindex.ToString("D6");
entity.BarCode = string.Format("WF{0}{1:00000}", DateTime.Today.ToString("yyyyMMdd"), indexCode);
entity._2DQRCode = string.Format(ButcherAppContext.Context.UrlConfig.OutAddress + "?code={0}&name={1}", entity.BarCode, goodsName);
return entity;
}
private SegmentationWeightRecord GetRecordBySet(SegmentationWeightGoodSet set,decimal maoWeight)
{
var record=new SegmentationWeightRecord();
@ -393,7 +425,7 @@ namespace SegmentationWeight
uDataGridView1.DataSource = mWeightRecords;
}
public string RoleName { get { return "分割计数"; } }
public string RoleName { get { return "分割称重"; } }
public Form Generate()
{
return this;


+ 60
- 0
SegmentationWeight/SegmentationWeightPrint.cs View File

@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BWP.WinFormControl;
namespace SegmentationWeight
{
public class SegmentationWeightPrint
{
public static void Print(PrintEntity entity)
{
PrintAPI.B_GetUSBBufferLen();
PrintAPI.B_EnumUSB(new byte[128]);
PrintAPI.B_CreateUSBPort(1);
PrintAPI.B_Prn_Text_TrueType(110, 26, 31, "宋体", 1, 700, 0, 0, 0, "C1", entity.AccountingUnit_Name);
PrintAPI.B_Prn_Text_TrueType(42, 70, 31, "宋体", 1, 700, 0, 0, 0, "C2", "合格证");
PrintAPI.B_Prn_Text_TrueType(440, 70, 31, "宋体", 1, 700, 0, 0, 0, "C3", entity.Goods_Name);
PrintAPI.B_Prn_Text_TrueType(42, 120, 27, "宋体", 1, 400, 0, 0, 0, "C4", string.Format("生产日期:{0}", entity.Date.ToString("yyyy/MM/dd")));
PrintAPI.B_Prn_Text_TrueType(42, 160, 27, "宋体", 1, 400, 0, 0, 0, "C5", string.Format("检 验 员:{0}", entity.Checker));
PrintAPI.B_Prn_Text_TrueType(42, 200, 27, "宋体", 1, 400, 0, 0, 0, "C6", string.Format("保 质 期:{0}", entity.StoreCondition));
PrintAPI.B_Prn_Text_TrueType(42, 240, 23, "宋体", 1, 400, 0, 0, 0, "C7", string.Format("电话:{0}", entity.TelNumber));
PrintAPI.B_Prn_Text_TrueType(42, 280, 23, "宋体", 1, 400, 0, 0, 0, "C8", string.Format("产地:{0}", entity.Place));
PrintAPI.B_Prn_Barcode(42, 320, 0, "1", 3, 22, 35, 'N', entity.BarCode);
PrintAPI.B_Prn_Text_TrueType(173, 360, 25, "宋体", 1, 500, 0, 0, 0, "C9", entity.BarCode);
PrintAPI.B_Bar2d_QR(430, 105, 2, 6, 'M', 'A', 0, 0, 0, entity._2DQRCode);
PrintAPI.B_Set_Direction('B');
PrintAPI.B_Print_Out(1);
PrintAPI.B_ClosePrn();
}
}
public class PrintEntity
{
public string AccountingUnit_Name { get; set; }
public string Goods_Name { get; set; }
public DateTime Date { get; set; }
public string Checker { get; set; }
public string StoreCondition { get; set; }
public string Place { get; set; }
public string TelNumber { get; set; }
public string Address { get; set; }
public string BarCode { get; set; }
public string _2DQRCode { get; set; }
}
}

+ 54
- 154
TrunksIousOutInStore/TrunksIousOutInStoreForm.Designer.cs View File

@ -29,23 +29,20 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
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();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
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();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.panel1 = new System.Windows.Forms.Panel();
this.enableWeight = new System.Windows.Forms.CheckBox();
this.panel2 = new System.Windows.Forms.Panel();
this.lblChengZhong = new System.Windows.Forms.Label();
this.btnWeightSet = new System.Windows.Forms.Button();
this.btnSycnStatus = new System.Windows.Forms.Button();
this.btnNetStatus = new System.Windows.Forms.Button();
this.btnWeightSet = new System.Windows.Forms.Button();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.cbxBaiTiaoStatus = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.btnCreateBill = new System.Windows.Forms.Button();
this.btnSubmit = new System.Windows.Forms.Button();
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
@ -63,12 +60,7 @@
this.uncheck产品名称 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.uncheck数量 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.uncheck重量 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.flpClass = new System.Windows.Forms.FlowLayoutPanel();
this.flpGoods = new System.Windows.Forms.FlowLayoutPanel();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.timerChectNetStatus = new System.Windows.Forms.Timer(this.components);
this.timerSyncToService = new System.Windows.Forms.Timer(this.components);
this.timerCheckSyncSucessed = new System.Windows.Forms.Timer(this.components);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@ -81,7 +73,6 @@
this.splitContainer2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit();
this.splitContainer3.Panel1.SuspendLayout();
this.splitContainer3.Panel2.SuspendLayout();
this.splitContainer3.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridChecked)).BeginInit();
@ -116,6 +107,7 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.Controls.Add(this.enableWeight);
this.panel1.Controls.Add(this.panel2);
this.panel1.Controls.Add(this.btnNetStatus);
this.panel1.Controls.Add(this.btnWeightSet);
this.panel1.Location = new System.Drawing.Point(11, 3);
this.panel1.Name = "panel1";
@ -155,6 +147,17 @@
this.lblChengZhong.TabIndex = 0;
this.lblChengZhong.Text = "0.00";
//
// btnNetStatus
//
this.btnNetStatus.Enabled = false;
this.btnNetStatus.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnNetStatus.Location = new System.Drawing.Point(515, 8);
this.btnNetStatus.Name = "btnNetStatus";
this.btnNetStatus.Size = new System.Drawing.Size(120, 46);
this.btnNetStatus.TabIndex = 0;
this.btnNetStatus.Text = "网络畅通";
this.btnNetStatus.UseVisualStyleBackColor = true;
//
// btnWeightSet
//
this.btnWeightSet.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@ -166,28 +169,6 @@
this.btnWeightSet.UseVisualStyleBackColor = true;
this.btnWeightSet.Click += new System.EventHandler(this.btnWeightSet_Click);
//
// btnSycnStatus
//
this.btnSycnStatus.Enabled = false;
this.btnSycnStatus.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSycnStatus.Location = new System.Drawing.Point(61, 83);
this.btnSycnStatus.Name = "btnSycnStatus";
this.btnSycnStatus.Size = new System.Drawing.Size(120, 46);
this.btnSycnStatus.TabIndex = 0;
this.btnSycnStatus.Text = "同步完成";
this.btnSycnStatus.UseVisualStyleBackColor = true;
//
// btnNetStatus
//
this.btnNetStatus.Enabled = false;
this.btnNetStatus.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnNetStatus.Location = new System.Drawing.Point(61, 14);
this.btnNetStatus.Name = "btnNetStatus";
this.btnNetStatus.Size = new System.Drawing.Size(120, 46);
this.btnNetStatus.TabIndex = 0;
this.btnNetStatus.Text = "网络畅通";
this.btnNetStatus.UseVisualStyleBackColor = true;
//
// splitContainer2
//
this.splitContainer2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
@ -197,12 +178,8 @@
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.cbxBaiTiaoStatus);
this.splitContainer2.Panel1.Controls.Add(this.label2);
this.splitContainer2.Panel1.Controls.Add(this.btnCreateBill);
this.splitContainer2.Panel1.Controls.Add(this.btnSycnStatus);
this.splitContainer2.Panel1.Controls.Add(this.btnSubmit);
this.splitContainer2.Panel1.Controls.Add(this.btnNetStatus);
//
// splitContainer2.Panel2
//
@ -212,31 +189,6 @@
this.splitContainer2.SplitterWidth = 1;
this.splitContainer2.TabIndex = 0;
//
// cbxBaiTiaoStatus
//
this.cbxBaiTiaoStatus.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbxBaiTiaoStatus.Font = new System.Drawing.Font("宋体", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cbxBaiTiaoStatus.FormattingEnabled = true;
this.cbxBaiTiaoStatus.Items.AddRange(new object[] {
"入预冷库",
"分割领用",
"入销售库",
"销售出库"});
this.cbxBaiTiaoStatus.Location = new System.Drawing.Point(41, 197);
this.cbxBaiTiaoStatus.Name = "cbxBaiTiaoStatus";
this.cbxBaiTiaoStatus.Size = new System.Drawing.Size(167, 35);
this.cbxBaiTiaoStatus.TabIndex = 34;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(41, 170);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(106, 24);
this.label2.TabIndex = 1;
this.label2.Text = "白条状态";
//
// btnCreateBill
//
this.btnCreateBill.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@ -270,13 +222,8 @@
//
this.splitContainer3.Panel1.Controls.Add(this.groupBox2);
this.splitContainer3.Panel1.Controls.Add(this.groupBox1);
//
// splitContainer3.Panel2
//
this.splitContainer3.Panel2.Controls.Add(this.flpClass);
this.splitContainer3.Panel2.Controls.Add(this.flpGoods);
this.splitContainer3.Size = new System.Drawing.Size(1015, 610);
this.splitContainer3.SplitterDistance = 726;
this.splitContainer3.SplitterDistance = 780;
this.splitContainer3.SplitterWidth = 1;
this.splitContainer3.TabIndex = 0;
//
@ -288,7 +235,7 @@
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(699, 340);
this.groupBox2.Size = new System.Drawing.Size(755, 340);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "已提交";
@ -299,17 +246,17 @@
this.gridChecked.AllowUserToDeleteRows = false;
this.gridChecked.AllowUserToResizeColumns = false;
this.gridChecked.AllowUserToResizeRows = false;
dataGridViewCellStyle13.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.gridChecked.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.gridChecked.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.gridChecked.BackgroundColor = System.Drawing.Color.White;
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.gridChecked.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14;
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.gridChecked.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.gridChecked.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.gridChecked.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.,
@ -323,20 +270,22 @@
this.gridChecked.Name = "gridChecked";
this.gridChecked.ReadOnly = true;
this.gridChecked.RowHeadersVisible = false;
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.gridChecked.RowsDefaultCellStyle = dataGridViewCellStyle15;
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.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.Size = new System.Drawing.Size(749, 320);
this.gridChecked.TabIndex = 4;
//
// 序号
//
this..AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
this..DataPropertyName = "ID";
this..HeaderText = "序号";
this..Name = "序号";
this..ReadOnly = true;
this..Width = 60;
//
// 条码
//
@ -375,7 +324,7 @@
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(705, 220);
this.groupBox1.Size = new System.Drawing.Size(761, 220);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "待提交";
@ -386,17 +335,17 @@
this.gridUnCheck.AllowUserToDeleteRows = false;
this.gridUnCheck.AllowUserToResizeColumns = false;
this.gridUnCheck.AllowUserToResizeRows = false;
dataGridViewCellStyle16.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.gridUnCheck.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle16;
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;
dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle17.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle17.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle17.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle17.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle17.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle17.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.gridUnCheck.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle17;
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序号,
@ -410,12 +359,12 @@
this.gridUnCheck.Name = "gridUnCheck";
this.gridUnCheck.ReadOnly = true;
this.gridUnCheck.RowHeadersVisible = false;
dataGridViewCellStyle18.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle18.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.gridUnCheck.RowsDefaultCellStyle = dataGridViewCellStyle18;
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(699, 200);
this.gridUnCheck.Size = new System.Drawing.Size(755, 200);
this.gridUnCheck.TabIndex = 3;
//
// uncheck序号
@ -436,11 +385,12 @@
//
// uncheck产品名称
//
this.uncheck产品名称.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
this.uncheck产品名称.DataPropertyName = "Goods_Name";
this.uncheck产品名称.HeaderText = "产品名称";
this.uncheck产品名称.Name = "uncheck产品名称";
this.uncheck产品名称.ReadOnly = true;
this.uncheck产品名称.Width = 120;
this.uncheck产品名称.Width = 97;
//
// uncheck数量
//
@ -456,51 +406,12 @@
this.uncheck重量.Name = "uncheck重量";
this.uncheck重量.ReadOnly = true;
//
// flpClass
//
this.flpClass.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.flpClass.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.flpClass.Location = new System.Drawing.Point(3, 11);
this.flpClass.Name = "flpClass";
this.flpClass.Size = new System.Drawing.Size(283, 76);
this.flpClass.TabIndex = 1;
//
// 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(0, 117);
this.flpGoods.Name = "flpGoods";
this.flpGoods.Size = new System.Drawing.Size(289, 491);
this.flpGoods.TabIndex = 0;
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 3000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// timerChectNetStatus
//
this.timerChectNetStatus.Enabled = true;
this.timerChectNetStatus.Interval = 2000;
this.timerChectNetStatus.Tick += new System.EventHandler(this.timerChectNetStatus_Tick);
//
// timerSyncToService
//
this.timerSyncToService.Enabled = true;
this.timerSyncToService.Interval = 5000;
this.timerSyncToService.Tick += new System.EventHandler(this.timerSyncToService_Tick);
//
// timerCheckSyncSucessed
//
this.timerCheckSyncSucessed.Enabled = true;
this.timerCheckSyncSucessed.Interval = 4000;
this.timerCheckSyncSucessed.Tick += new System.EventHandler(this.timerCheckSyncSucessed_Tick);
//
// TrunksIousOutInStoreForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@ -516,7 +427,6 @@
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TrunksIousOutInStoreForm_FormClosing);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.TrunksIousOutInStoreForm_FormClosed);
this.Load += new System.EventHandler(this.TrunksIousOutInStoreForm_Load);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TrunksIousOutInStoreForm_KeyDown);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
@ -526,12 +436,10 @@
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel1.PerformLayout();
this.splitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.splitContainer3.Panel1.ResumeLayout(false);
this.splitContainer3.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit();
this.splitContainer3.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
@ -549,7 +457,6 @@
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.Button btnNetStatus;
private System.Windows.Forms.SplitContainer splitContainer3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnCreateBill;
private System.Windows.Forms.Button btnSubmit;
private System.Windows.Forms.Button btnWeightSet;
@ -557,16 +464,10 @@
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.CheckBox enableWeight;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label lblChengZhong;
private System.Windows.Forms.ComboBox cbxBaiTiaoStatus;
private System.Windows.Forms.FlowLayoutPanel flpGoods;
private System.Windows.Forms.Timer timerChectNetStatus;
private System.Windows.Forms.Timer timerSyncToService;
private System.Windows.Forms.Timer timerCheckSyncSucessed;
private System.Windows.Forms.Button btnSycnStatus;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
private System.Windows.Forms.DataGridViewTextBoxColumn ;
@ -577,6 +478,5 @@
private System.Windows.Forms.DataGridViewTextBoxColumn uncheck产品名称;
private System.Windows.Forms.DataGridViewTextBoxColumn uncheck数量;
private System.Windows.Forms.DataGridViewTextBoxColumn uncheck重量;
private System.Windows.Forms.FlowLayoutPanel flpClass;
}
}

+ 195
- 288
TrunksIousOutInStore/TrunksIousOutInStoreForm.cs View File

@ -17,6 +17,8 @@ using BO.BO.Dtos;
using BO.Utils;
using BO.Utils.BillRpc;
using BWP.WinFormControl.WeightDataFormat;
using Forks.JsonRpc.Client;
using Newtonsoft.Json;
using TrunksIousOutInStore.LocalSyncBO;
using TrunksIousOutInStore.Rpc;
@ -24,9 +26,10 @@ namespace TrunksIousOutInStore
{
public partial class TrunksIousOutInStoreForm : Form, IAfterLogin
{
private Thread tdSyncUnSubmit, tdSyncSubmited;
private readonly string BaseRpcUrl = "/MainSystem/B3ClientService/Rpcs/BillRpc/TrunksIousOutInStoreRecord_/TrunksIousOutInStoreRecordRpc/";
private readonly string ClientGoodsSetApplyClient = "白条出入库";
public const string DATA_PATH = "LocalData/TrunksIousOutInStore";
// BardCodeHooK BarCode = new BardCodeHooK();
@ -51,42 +54,45 @@ namespace TrunksIousOutInStore
{
if (_inQueryThread != null && _inQueryThread.IsAlive)
DisableWeight();
// if (syncWork != null && syncWork.IsAlive)
// syncWork.Abort();
// if (syncToServer != null && syncToServer.IsAlive)
// syncToServer.Abort();
if (tdSyncUnSubmit != null && tdSyncUnSubmit.IsAlive)
tdSyncUnSubmit.Abort();
if (tdSyncSubmited != null && tdSyncSubmited.IsAlive)
tdSyncSubmited.Abort();
};
// BarCode.BarCodeEvent += new BardCodeHooK.BardCodeDeletegate(BarCode_BarCodeEvent);
if (!Directory.Exists(DATA_PATH))
{
Directory.CreateDirectory(DATA_PATH);
}
}
void BarCode_BarCodeEvent(BardCodeHooK.BarCodes barCode)
{
ShowInfo(barCode);
}
private delegate void ShowInfoDelegate(BardCodeHooK.BarCodes barCode);
private void ShowInfo(BardCodeHooK.BarCodes barCode)
{
if (this.InvokeRequired)
{
this.BeginInvoke(new ShowInfoDelegate(ShowInfo), new object[] { barCode });
}
else
{
if (barCode.IsValid)
{
// var code = UrlUtil.GetBarCode(barCode.BarCode.Trim());
// var goodsName = UrlUtil.GetGoodsName(barCode.BarCode);
var code = barCode.BarCode.Trim();
doInsertUnSubmit(code, "", null);
}
}
}
tdSyncUnSubmit=new Thread(SyncUnSubmit);
tdSyncSubmited = new Thread(SyncSubmited);
tdSyncUnSubmit.Start();
tdSyncSubmited.Start();
}
// void BarCode_BarCodeEvent(BardCodeHooK.BarCodes barCode)
// {
// ShowInfo(barCode);
// }
// private delegate void ShowInfoDelegate(BardCodeHooK.BarCodes barCode);
//
// private void ShowInfo(BardCodeHooK.BarCodes barCode)
// {
// if (this.InvokeRequired)
// {
// this.BeginInvoke(new ShowInfoDelegate(ShowInfo), new object[] { barCode });
// }
// else
// {
// if (barCode.IsValid)
// {
// // var code = UrlUtil.GetBarCode(barCode.BarCode.Trim());
// // var goodsName = UrlUtil.GetGoodsName(barCode.BarCode);
// var code = barCode.BarCode.Trim();
// doInsertUnSubmit(code, "", null);
// }
// }
// }
#region weightNeed
void OpenSerialPort()
@ -182,7 +188,7 @@ namespace TrunksIousOutInStore
if (str != "0")
{
//AddWeightDetail(decimal.Parse(lblChengZhong.Text));
doInsertUnSubmit("", "", decimal.Parse(lblChengZhong.Text));
doInsertUnSubmit( decimal.Parse(lblChengZhong.Text));
}
}));
}
@ -205,7 +211,7 @@ namespace TrunksIousOutInStore
//lblChengZhong.Text = string.Format(format, num);
if (str != "0")
{
doInsertUnSubmit("", "", decimal.Parse(string.Format(format, num)));
doInsertUnSubmit(decimal.Parse(string.Format(format, num)));
//AddWeightDetail(decimal.Parse(string.Format(format, num)));
}
}));
@ -296,59 +302,35 @@ namespace TrunksIousOutInStore
static object _obj = new object();
private void doInsertUnSubmit(string barCode, string goodsName, decimal? weight)
private void doInsertUnSubmit(decimal weight)
{
lock (_obj)
{
var record = new TrunksIousOutInStoreRecord();
record.Goods_Name = goodsName;
var set = GetSelectedClientGoodsSet();
if (set != null)
{
record.Goods_Name = set.Goods_Name;
record.Goods_ID = set.Goods_ID;
}
record.Number = 1;
record.CarcassStatus = cbxBaiTiaoStatus.Text;
if (!string.IsNullOrWhiteSpace(barCode))
{//扫码
record.BarCode = barCode;
//找到条码为空但是重量不为空的
var fd = unSumbitList.FirstOrDefault(x => string.IsNullOrWhiteSpace(x.BarCode) && x.Weight.HasValue);
if (fd == null)
{
// record.ID = unSumbitList.Max(x => x.ID) + 1;
unSumbitList.Add(record);
}
else
{
//给条码赋值
fd.BarCode = barCode;
}
}
if (weight.HasValue)
{//称重
record.Weight = weight;
//称重
//找到称重为空条码不为空的
var fd = unSumbitList.FirstOrDefault(x => !string.IsNullOrWhiteSpace(x.BarCode) && x.Weight == null);
var fd = unSubmitList.LastOrDefault(x => !string.IsNullOrWhiteSpace(x.BarCode) && x.Weight == null);
if (fd == null)
{
//todo 记录一个异常
// record.ID = unSumbitList.Max(x => x.ID) + 1;
unSumbitList.Add(record);
// unSumbitList.Add(record);
}
else
{
//给条码赋值
fd.Weight = weight;
//请求中间服务器
RpcFacade.Call<long>(BaseRpcUrl+ "SetWeight", fd.ID, weight);
}
}
gridUnCheck.Refresh();
Application.DoEvents();
// BindUnCheckGrid();
}
// barCodequeue.Enqueue(barCode);
}
@ -361,170 +343,132 @@ namespace TrunksIousOutInStore
{
return this;
}
string goodsSetFileName = Path.Combine(DATA_PATH, "TrunksIousOutInStoreClientGoodsSet.xml");
private List<TrunksIousOutInStoreClientGoodsSet> mLocaList;
void InitLocalList()
{
if (LoginRpcUtil.TestConnection())
{
mLocaList = ClientGoodsSetRpc.GetListByApplyClient(ClientGoodsSetApplyClient).Select(x => x.CreateChild<TrunksIousOutInStoreClientGoodsSet>()).ToList();
XmlUtil.SerializerObjToFile(mLocaList, goodsSetFileName);
}
else
{
mLocaList = XmlUtil.DeserializeFromFile<List<TrunksIousOutInStoreClientGoodsSet>>(goodsSetFileName);
}
}
private void TrunksIousOutInStoreForm_Load(object sender, EventArgs e)
{
// BarCode.Start();
InitLocalList();
InitGoodsControl();
GridUnCheckFocus();
//GridUnCheckFocus();
}
private void InitGoodsControl()
private void TrunksIousOutInStoreForm_FormClosing(object sender, FormClosingEventArgs e)
{
flpClass.Controls.Clear();
foreach (IGrouping<string, TrunksIousOutInStoreClientGoodsSet> grouping in mLocaList.Where(x => !string.IsNullOrWhiteSpace(x.Name)).GroupBy(x => x.Name))
if (unSubmitList.Count > 0)
{
var btn = CreateClassButton(grouping.Key);
flpClass.Controls.Add(btn);
if (MessageBox.Show("待提交区域不为空,确定关闭?", "确定关闭", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) ==
DialogResult.OK)
{
e.Cancel = false;
}
else
{
e.Cancel = true;
}
}
}
private Button CreateClassButton(string text)
{
var btn = new Button() { Text = text };
btn.Width = 100;
btn.Height = 60;
btn.Click += BtnClass_Click;
return btn;
}
BindingList<TrunksIousOutInStoreRecord> unSubmitList = new BindingList<TrunksIousOutInStoreRecord>();
BindingList<TrunksIousOutInStoreRecord> submitedList = new BindingList<TrunksIousOutInStoreRecord>();
// ConcurrentQueue<string> barCodequeue=new ConcurrentQueue<string>();
private void BtnClass_Click(object sender, EventArgs e)
{
var btnClass = sender as Button;
flpGoods.Controls.Clear();
foreach (TrunksIousOutInStoreClientGoodsSet set in mLocaList.Where(x => x.Name == btnClass.Text))
{
var btn = CreateGoodsSetButton(set);
flpGoods.Controls.Add(btn);
}
GridUnCheckFocus();
Application.DoEvents();
}
private Button CreateGoodsSetButton(TrunksIousOutInStoreClientGoodsSet set)
{
var btn = new Button();
btn.Text = set.Goods_Name;
btn.Tag = set;
btn.Width = 100;
btn.Height = 60;
btn.Click += BtnSet_Click;
return btn;
}
private void BtnSet_Click(object sender, EventArgs e)
// private static object _unSubmitListObj=new object();
// void AddUnSubmitList(TrunksIousOutInStoreRecord record)
// {
// lock (_unSubmitListObj)
// {
// unSubmitList.Add(record);
// }
// }
// void RemoveUnSubmitList(TrunksIousOutInStoreRecord record)
// {
// lock (_unSubmitListObj)
// {
// unSubmitList.Remove(record);
// }
// }
void SyncUnSubmit()
{
var btn = sender as Button;
foreach (Button button in flpGoods.Controls)
while (true)
{
if (button.Text == btn.Text)
var json = RpcFacade.Call<string>("/MainSystem/B3ClientService/Rpcs/BillRpc/TrunksIousOutInStoreRecord_/TrunksIousOutInStoreRecordRpc/GetUnSubmitList");
var list = JsonConvert.DeserializeObject<List<TrunksIousOutInStoreRecord>>(json);
if (this.IsHandleCreated)
{
if (button.BackColor == Color.Aqua)
{
button.BackColor = SystemColors.Control;
}
else
this.Invoke(new Action(() =>
{
button.BackColor = Color.Aqua;
}
if (list.Count > 0)
{
unSubmitList.Clear();
foreach (TrunksIousOutInStoreRecord record in list)
{
unSubmitList.Add(record);
}
}
BindUnSubmitGrid();
}));
}
else
{
button.BackColor = SystemColors.Control;
Thread.Sleep(2000);
}
}
gridUnCheck.Focus();
Application.DoEvents();
}
TrunksIousOutInStoreClientGoodsSet GetSelectedClientGoodsSet()
void SyncSubmited()
{
foreach (Button button in flpGoods.Controls)
while (true)
{
if (button.BackColor == Color.Aqua)
{
return button.Tag as TrunksIousOutInStoreClientGoodsSet;
}
}
return null;
}
var json = RpcFacade.Call<string>("/MainSystem/B3ClientService/Rpcs/BillRpc/TrunksIousOutInStoreRecord_/TrunksIousOutInStoreRecordRpc/GetSubmitedList");
var list = JsonConvert.DeserializeObject<List<TrunksIousOutInStoreRecord>>(json);
private void TrunksIousOutInStoreForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (unSumbitList.Count > 0)
{
if (MessageBox.Show("待提交区域不为空,确定关闭?", "确定关闭", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) ==
DialogResult.OK)
if (this.IsHandleCreated)
{
e.Cancel = false;
}
else
{
e.Cancel = true;
this.Invoke(new Action(() =>
{
if (list.Count > 0)
{
submitedList.Clear();
foreach (TrunksIousOutInStoreRecord record in list)
{
submitedList.Add(record);
}
}
BindSubmitedGrid();
}));
}
Thread.Sleep(2000);
}
}
BindingList<TrunksIousOutInStoreRecord> unSumbitList = new BindingList<TrunksIousOutInStoreRecord>();
BindingList<TrunksIousOutInStoreRecord> sumbitedList = new BindingList<TrunksIousOutInStoreRecord>();
// ConcurrentQueue<string> barCodequeue=new ConcurrentQueue<string>();
private void timer1_Tick(object sender, EventArgs e)
void BindUnSubmitGrid()
{
timer1.Stop();
if (unSumbitList == null)
if (gridUnCheck.DataSource == null)
{
return;
gridUnCheck.DataSource = unSubmitList;
}
var canSubmitList = unSumbitList.Where(x => !string.IsNullOrWhiteSpace(x.BarCode) && x.Weight != null).ToList();
foreach (TrunksIousOutInStoreRecord record in canSubmitList)
else
{
LocalDmoSession.Insert(record);
unSumbitList.Remove(record);
sumbitedList.Insert(0, record);
gridUnCheck.Refresh();
}
BindUnCheckGrid();
BindCheckedGrid();
timer1.Start();
// gridUnCheck.CurrentCell = null;
}
void BindUnCheckGrid()
{
gridUnCheck.DataSource = unSumbitList;
}
void BindCheckedGrid()
void BindSubmitedGrid()
{
gridChecked.DataSource = sumbitedList;
if (gridChecked.DataSource == null)
{
gridChecked.DataSource = submitedList;
}
else
{
gridChecked.Refresh();
}
// gridChecked.CurrentCell = null;
}
@ -535,14 +479,14 @@ namespace TrunksIousOutInStore
if (f.ShowDialog() == DialogResult.OK)
{
enableWeight_Click(sender, e);
GridUnCheckFocus();
// GridUnCheckFocus();
}
}
void GridUnCheckFocus()
{
gridUnCheck.Focus();
}
// void GridUnCheckFocus()
// {
// gridUnCheck.Focus();
// }
private void TrunksIousOutInStoreForm_FormClosed(object sender, FormClosedEventArgs e)
{
@ -573,93 +517,56 @@ namespace TrunksIousOutInStore
#endregion
#region 同步到中间服务器
//同步到
private void timerSyncToService_Tick(object sender, EventArgs e)
{
timerSyncToService.Stop();
if (LoginRpcUtil.TestConnection())
{
TrunksIousOutInStoreRecordRpc.GetInstance().SyncToServer();
}
timerSyncToService.Start();
}
#endregion
#region 检查是否同步完成
//检查是否同步完成
private void timerCheckSyncSucessed_Tick(object sender, EventArgs e)
{
timerCheckSyncSucessed.Stop();
if (LoginRpcUtil.TestConnection())
{
if (TrunksIousOutInStoreRecordRpc.GetInstance().IsSyncSucessed())
{
btnSycnStatus.Text = "同步完成";
btnSycnStatus.BackColor = Color.Green;
}
else
{
btnSycnStatus.Text = "正在同步";
btnSycnStatus.BackColor = Color.Red;
}
}
timerCheckSyncSucessed.Start();
}
#endregion
private void btnCreateBill_Click(object sender, EventArgs e)
{
GridUnCheckFocus();
}
BwpBarCodes barCodes = new BwpBarCodes();
private void TrunksIousOutInStoreForm_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == (Keys.ShiftKey | Keys.Shift))
{
return;
}
TimeSpan ts = DateTime.Now.Subtract(barCodes.Time);
var str = BwpBarCodeUtil.GetStringByKeyKeyEventArgs(e);
barCodes.StringBuilder.Append(str);
if (ts.TotalMilliseconds < 50)
{
if (e.KeyData == Keys.Enter && barCodes.BarCode.Length > 0)
{
//回车
barCodes.IsValid = true;
barCodes.StringBuilder.Remove(barCodes.StringBuilder.Length - 1, 1);
}
}
try
{
if (barCodes.IsValid)
{
// MessageBox.Show(barCodes.BarCode);
var code = UrlUtil.GetBarCode(barCodes.BarCode.ToLower().Trim());
var goodsName = UrlUtil.GetGoodsName(barCodes.BarCode.ToLower());
doInsertUnSubmit(code, goodsName, null);
barCodes.StringBuilder = new StringBuilder();
}
}
catch
{
}
finally
{
barCodes.IsValid = false; //最后一定要 设置barCode无效
barCodes.Time = DateTime.Now;
}
}
// GridUnCheckFocus();
}
// BwpBarCodes barCodes = new BwpBarCodes();
//
// private void TrunksIousOutInStoreForm_KeyDown(object sender, KeyEventArgs e)
// {
// if (e.KeyData == (Keys.ShiftKey | Keys.Shift))
// {
// return;
// }
// TimeSpan ts = DateTime.Now.Subtract(barCodes.Time);
// var str = BwpBarCodeUtil.GetStringByKeyKeyEventArgs(e);
// barCodes.StringBuilder.Append(str);
//
// if (ts.TotalMilliseconds < 50)
// {
// if (e.KeyData == Keys.Enter && barCodes.BarCode.Length > 0)
// {
// //回车
// barCodes.IsValid = true;
// barCodes.StringBuilder.Remove(barCodes.StringBuilder.Length - 1, 1);
// }
// }
// try
// {
// if (barCodes.IsValid)
// {
// // MessageBox.Show(barCodes.BarCode);
// var code = UrlUtil.GetBarCode(barCodes.BarCode.ToLower().Trim());
// var goodsName = UrlUtil.GetGoodsName(barCodes.BarCode.ToLower());
//
// doInsertUnSubmit(code, goodsName, null);
// barCodes.StringBuilder = new StringBuilder();
// }
// }
// catch(Exception ex)
// {
// MessageBox.Show(ex.ToString());
// }
// finally
// {
//
// barCodes.IsValid = false; //最后一定要 设置barCode无效
// barCodes.Time = DateTime.Now;
// }
//
// }
}
}

+ 3
- 9
TrunksIousOutInStore/TrunksIousOutInStoreForm.resx View File

@ -147,16 +147,10 @@
<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>4, 19</value>
</metadata>
<metadata name="timerChectNetStatus.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>98, 19</value>
</metadata>
<metadata name="timerSyncToService.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>273, 19</value>
<value>180, 26</value>
</metadata>
<metadata name="timerCheckSyncSucessed.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>440, 19</value>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>65</value>
</metadata>
</root>

+ 3
- 3
WeighAndGrading/GradeFrom.cs View File

@ -435,11 +435,11 @@ namespace WeighAndGrading
string goodsName;
if (jibie == "烫褪")
{
goodsName = "带皮白条";
goodsName ="dpbt"; //"带皮白条";
}
else
{
goodsName = "去皮白条";
goodsName ="qpbt"; //"去皮白条";
}
var entity = new PrintEntity();
@ -465,7 +465,7 @@ namespace WeighAndGrading
string indexCode = maxindex.ToString("D6");
entity.BarCode = string.Format("WF{0}{1:00000}", DateTime.Today.ToString("yyyyMMdd"), indexCode);
entity._2DQRCode = string.Format("http://www.bwpsoft.com?code={0}&name={1}", entity.BarCode, goodsName);
entity._2DQRCode = string.Format(ButcherAppContext.Context.UrlConfig.OutAddress+"?code={0}&name={1}", entity.BarCode, goodsName);
return entity;
}


+ 6
- 0
WinFormTest/App.config View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

+ 63
- 0
WinFormTest/Form1.Designer.cs View File

@ -0,0 +1,63 @@
namespace WinFormTest
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(40, 98);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 12);
this.label1.TabIndex = 0;
this.label1.Text = "label1";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(601, 452);
this.Controls.Add(this.label1);
this.Name = "Form1";
this.Text = "Form1";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed);
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
}
}

+ 57
- 0
WinFormTest/Form1.cs View File

@ -0,0 +1,57 @@
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;
namespace WinFormTest
{
public partial class Form1 : Form
{
BardCodeHooK BarCode = new BardCodeHooK();
public Form1()
{
InitializeComponent();
BarCode.BarCodeEvent += new BardCodeHooK.BardCodeDeletegate(BarCode_BarCodeEvent);
}
void BarCode_BarCodeEvent(BardCodeHooK.BarCodes barCode)
{
ShowInfo(barCode);
}
private delegate void ShowInfoDelegate(BardCodeHooK.BarCodes barCode);
private void ShowInfo(BardCodeHooK.BarCodes barCode)
{
if (this.InvokeRequired)
{
this.BeginInvoke(new ShowInfoDelegate(ShowInfo), new object[] { barCode });
}
else
{
if (barCode.IsValid)
{
// var code = UrlUtil.GetBarCode(barCode.BarCode.Trim());
// var goodsName = UrlUtil.GetGoodsName(barCode.BarCode);
var code = barCode.BarCode.Trim();
label1.Text = code;
}
}
}
private void Form1_Load(object sender, EventArgs e)
{
BarCode.Start();
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
BarCode.Stop();
}
}
}

+ 120
- 0
WinFormTest/Form1.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>

+ 22
- 0
WinFormTest/Program.cs View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WinFormTest
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

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

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

+ 71
- 0
WinFormTest/Properties/Resources.Designer.cs View File

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace WinFormTest.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WinFormTest.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 覆盖当前线程的 CurrentUICulture 属性
/// 使用此强类型的资源类的资源查找。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

+ 117
- 0
WinFormTest/Properties/Resources.resx View File

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

+ 30
- 0
WinFormTest/Properties/Settings.Designer.cs View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WinFormTest.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

+ 7
- 0
WinFormTest/Properties/Settings.settings View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

+ 99
- 0
WinFormTest/WinFormTest.csproj View File

@ -0,0 +1,99 @@
<?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>{E9831F50-FD30-465C-9BF1-D3C9C415EF5B}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WinFormTest</RootNamespace>
<AssemblyName>WinFormTest</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BO\BO.csproj">
<Project>{8968f14a-c7c7-4751-96ce-b114fbfd65ef}</Project>
<Name>BO</Name>
</ProjectReference>
<ProjectReference Include="..\BWP.WinFormControl\BWP.WinFormControl.csproj">
<Project>{a782b23e-be6d-4f51-b5cb-5cd259ba97cc}</Project>
<Name>BWP.WinFormControl</Name>
</ProjectReference>
</ItemGroup>
<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>

Loading…
Cancel
Save