Browse Source

修改。

master
yibo 8 years ago
parent
commit
0730f6b611
24 changed files with 2116 additions and 363 deletions
  1. +3
    -0
      BO/BO.csproj
  2. +23
    -0
      BO/BO/Bill/GradeAndWeight/GradeAndWeight.cs
  3. +31
    -0
      BO/BO/Bill/GradeAndWeight/GradeAndWeight_Detail.cs
  4. +3
    -3
      BO/Utils/AfterLoginUtil.cs
  5. +9
    -0
      BO/Utils/BaseInfoRpcUtil.cs
  6. +43
    -0
      BO/Utils/BillRpc/GradeAndWeightRpc.cs
  7. +1
    -4
      BWP.WinFormControl/BWP.WinFormControl.csproj
  8. BIN
      BWP.WinFormControl/TabButtonBackground.bmp
  9. +47
    -0
      BWP.WinFormControl/UComboBox.cs
  10. +53
    -0
      BWP.WinFormControl/User32ClassUtil.cs
  11. +0
    -23
      BWP.WinFormControl/WinApiSendMessage.cs
  12. +1
    -1
      ButcherWeight/WeightContext.cs
  13. +183
    -172
      ButcherWeight/WeightForm.Designer.cs
  14. +3
    -0
      ButcherWeight/WeightForm.resx
  15. BIN
      Setup/Release/Setup.msi
  16. +80
    -0
      WeighAndGrading/GradeContext.cs
  17. +581
    -154
      WeighAndGrading/GradeFrom.Designer.cs
  18. +482
    -2
      WeighAndGrading/GradeFrom.cs
  19. +34
    -4
      WeighAndGrading/GradeFrom.resx
  20. +229
    -0
      WeighAndGrading/GradeSettingFrom.Designer.cs
  21. +78
    -0
      WeighAndGrading/GradeSettingFrom.cs
  22. +120
    -0
      WeighAndGrading/GradeSettingFrom.resx
  23. +93
    -0
      WeighAndGrading/PrintAPI.cs
  24. +19
    -0
      WeighAndGrading/WeighAndGrading.csproj

+ 3
- 0
BO/BO.csproj View File

@ -53,12 +53,15 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BO\Bill\GradeAndWeight\GradeAndWeight.cs" />
<Compile Include="BO\Bill\GradeAndWeight\GradeAndWeight_Detail.cs" />
<Compile Include="BO\Bill\OrderDetail\NeedOrderEntity.cs" />
<Compile Include="BO\Bill\OrderDetail\OrderDetail.cs" />
<Compile Include="BO\Bill\SecondOrder\SecondOrder.cs" />
<Compile Include="BO\Bill\SecondOrder\SecondOrder_Detail.cs" />
<Compile Include="CTuple.cs" />
<Compile Include="Utils\AfterLoginUtil.cs" />
<Compile Include="Utils\BillRpc\GradeAndWeightRpc.cs" />
<Compile Include="Utils\BillRpc\OrderDetailRpc.cs" />
<Compile Include="Utils\BillRpc\SecondOrderRpc.cs" />
<Compile Include="Utils\ButcherAppContext.cs" />


+ 23
- 0
BO/BO/Bill/GradeAndWeight/GradeAndWeight.cs View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BO.BO.Bill
{
public class GradeAndWeight
{
public long OrderDetail_ID { get; set; }
public int Order { get; set; }
public string Technics_Name { get; set; }
public int Number { get; set; }
public int Already { get; set; }
public bool Finish { get { return Number == Already; } set { } }
}
}

+ 31
- 0
BO/BO/Bill/GradeAndWeight/GradeAndWeight_Detail.cs View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BO.BO.Bill
{
public class GradeAndWeight_Detail
{
public long ID { get; set; }
public int Index { get; set; }
public long OrderDetail_ID { get; set; }
public int Order { get; set; }
public short Technics { get; set; }
public string Technics_Name { get; set; }
public long Livestock_ID { get; set; }
public string Livestock_Name { get; set; }
public decimal? Weight { get; set; }
public DateTime Time { get; set; }
}
}

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

@ -21,12 +21,12 @@ namespace BO.Utils
//#if debug
static List<Tuple<string, string>> roleToAssemblies = new List<Tuple<string, string>>(){new Tuple<string,string>("排宰员",@"C:\BwpB3Project\src\B3ButcherManageClient\ButcherOrder\bin\Debug\ButcherOrder"),
new Tuple<string,string>("过磅员",@"C:\BwpB3Project\src\B3ButcherManageClient\ButcherWeight\bin\Debug\ButcherWeight"),
new Tuple<string,string>("验质员",@"C:\BwpB3Project\src\B3ButcherManageClient\QualityAndOrder\bin\Debug\QualityAndOrder")};
new Tuple<string,string>("验质员",@"C:\BwpB3Project\src\B3ButcherManageClient\QualityAndOrder\bin\Debug\QualityAndOrder"),new Tuple<string,string>("定级员",@"C:\BwpB3Project\src\B3ButcherManageClient\WeighAndGrading\bin\Debug\WeighAndGrading")};
//#endif
//#if !debug
// static List<Tuple<string, string>> roleToAssemblies = new List<Tuple<string, string>>(){new Tuple<string,string>("排宰员",@"ButcherOrder"),
//new Tuple<string,string>("过磅员",@"ButcherWeight"),
// new Tuple<string,string>("验质员",@"QualityAndOrder")};
// new Tuple<string,string>("验质员",@"QualityAndOrder"),new Tuple<string,string>("定级员",@"WeighAndGrading")};
//#endif
@ -39,7 +39,7 @@ namespace BO.Utils
var filePath = string.Format("{0}.dll", first.Item2);
//#endif
//#if !debug
//var filePath = Path.Combine(Application.StartupPath, string.Format("{0}.dll", first.Item2));
// var filePath = Path.Combine(Application.StartupPath, string.Format("{0}.dll", first.Item2));
//#endif
if (!File.Exists(filePath))
throw new Exception("相关模块不存在");


+ 9
- 0
BO/Utils/BaseInfoRpcUtil.cs View File

@ -6,11 +6,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Script.Serialization;
namespace BO.Utils
{
public static class BaseInfoRpcUtil
{
static JavaScriptSerializer serializer = new JavaScriptSerializer();
public static List<Tuple<string, string>> GetBaseInfoEntity(string rpcName)
{
var list = RpcFacade.Call<List<RpcObject>>(string.Format("/MainSystem/B3ClientService/Rpcs/BaseInfoRpc/{0}", rpcName), null, null, -1);
@ -34,5 +37,11 @@ namespace BO.Utils
}
return result;
}
public static List<CTuple<long, string, short>> GetLivestockList()
{
var list = RpcFacade.Call<string>("/MainSystem/B3ClientService/Rpcs/BaseInfoRpc/GetLivestock");
return serializer.Deserialize<List<CTuple<long, string, short>>>(list);
}
}
}

+ 43
- 0
BO/Utils/BillRpc/GradeAndWeightRpc.cs View File

@ -0,0 +1,43 @@
using BO.BO.Bill;
using Forks.JsonRpc.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Script.Serialization;
namespace BO.Utils.BillRpc
{
public static class GradeAndWeightRpc
{
static JavaScriptSerializer serializer = new JavaScriptSerializer();
public static List<GradeAndWeight> GetGradeAndWeightList(DateTime date)
{
const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/GradeAndWeightRpc/GetGradeAndWeightList";
var result = RpcFacade.Call<string>(method, date);
return serializer.Deserialize<List<GradeAndWeight>>(result);
}
public static List<GradeAndWeight_Detail> GetDetails(DateTime startDate, DateTime endDate, int? order, int type)
{
const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/GradeAndWeightRpc/GetDetailsList";
var result = RpcFacade.Call<string>(method, startDate, endDate, order, type);
result = result.ESerializeDateTime();
return serializer.Deserialize<List<GradeAndWeight_Detail>>(result);
}
public static void InsertDetail(GradeAndWeight_Detail detail)
{
const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/GradeAndWeightRpc/InsertDetail";
detail.ID = RpcFacade.Call<long>(method, serializer.Serialize(detail));
}
public static void FillDetailWeight(long id, decimal weight)
{
const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/GradeAndWeightRpc/FillWeight";
RpcFacade.Call<int>(method, id, weight);
}
}
}

+ 1
- 4
BWP.WinFormControl/BWP.WinFormControl.csproj View File

@ -88,7 +88,7 @@
<Compile Include="WeightControl.Designer.cs">
<DependentUpon>WeightControl.cs</DependentUpon>
</Compile>
<Compile Include="WinApiSendMessage.cs" />
<Compile Include="User32ClassUtil.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="Calendar.xaml">
@ -110,9 +110,6 @@
<DependentUpon>WeightControl.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TabButtonBackground.bmp" />
</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.


BIN
BWP.WinFormControl/TabButtonBackground.bmp View File

Before After

+ 47
- 0
BWP.WinFormControl/UComboBox.cs View File

@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
@ -24,6 +25,7 @@ namespace BWP.WinFormControl
// this.SelectedIndex = 1;
//else if (!_enableTopItem && Items.Count > 0)
// this.SelectedIndex = 0;
SelectionStart = Text.Length;
};
this.DrawMode = DrawMode.OwnerDrawFixed;
this.DrawItem += new DrawItemEventHandler(cb_DrawItem);
@ -79,6 +81,7 @@ namespace BWP.WinFormControl
base.OnKeyUp(e);
if (e.KeyCode == System.Windows.Forms.Keys.Enter)
{
this.FindForm().Cursor = Cursors.Default;
if (string.IsNullOrEmpty(this.Text) || this.DisplayValue != this.Text || string.IsNullOrEmpty(this.SelectedText))
{
if (!this.DroppedDown)
@ -166,5 +169,49 @@ namespace BWP.WinFormControl
return null;
}
}
protected override void OnDropDown(EventArgs e)
{
base.OnDropDown(e);
AdjustComboBoxDropDownListWidth(); //调整comboBox的下拉列表的大小
}
private void AdjustComboBoxDropDownListWidth()
{
Graphics g = null;
Font font = null;
try
{
int width = this.Width;
g = this.CreateGraphics();
font = this.Font;
//checks if a scrollbar will be displayed.
//If yes, then get its width to adjust the size of the drop down list.
int vertScrollBarWidth =
(this.Items.Count > this.MaxDropDownItems)
? SystemInformation.VerticalScrollBarWidth : 0;
int newWidth;
foreach (object s in this.Items) //Loop through list items and check size of each items.
{
if (s != null)
{
newWidth = (int)g.MeasureString(s.ToString().Trim(), font).Width
+ vertScrollBarWidth;
if (width < newWidth)
width = newWidth; //set the width of the drop down list to the width of the largest item.
}
}
this.DropDownWidth = width;
}
catch
{ }
finally
{
if (g != null)
g.Dispose();
}
}
}
}

+ 53
- 0
BWP.WinFormControl/User32ClassUtil.cs View File

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace BWP.WinFormControl
{
public class WinApiSendMessage
{
[DllImport("User32.dll", EntryPoint = "SendMessage")]
public static extern int SendMessage(
int hWnd, // handle to destination window
int Msg, // message
int wParam, // first message parameter
int lParam // second message parameter
);
[DllImport("User32.dll", EntryPoint = "FindWindow")]
public static extern int FindWindow(string lpClassName, string lpWindowName);
}
#region 窗体效果
public static class Animate
{
[System.Runtime.InteropServices.DllImport("user32")]
public static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);
/*
*
* BOOL AnimateWindowHWND hWndDWORD dwTimeDWORD dwFlags
* hWnd
* dwTime200
* dwFags
*
* 使GetLastError函数
* AW_HOR_POSITIVE或AW_HOR_NEGTVE与AW_VER_POSITVE或AW_VER_NEGATIVE组合来激活一个窗口
* WM_PRINT或WM_PRINTCLIENT消息WM_PRINTCLIENT消息WM_PRINT消息
* WIDdOWS NT5.0Windows98Windows CEWinuser.huser32.lib
*/
//标志描述:
public const int AW_SLIDE = 0x40000;//使用滑动类型。缺省则为滚动动画类型。当使用AW_CENTER标志时,这个标志就被忽略。
public const int AW_ACTIVATE = 0x20000;//激活窗口。在使用了AW_HIDE标志后不要使用这个标志。
public const int AW_BLEND = 0x80000;//使用淡出效果。只有当hWnd为顶层窗口的时候才可以使用此标志。
public const int AW_HIDE = 0x10000;//隐藏窗口,缺省则显示窗口。(关闭窗口用)
public const int AW_CENTER = 0x0010;//若使用了AW_HIDE标志,则使窗口向内重叠;若未使用AW_HIDE标志,则使窗口向外扩展。
public const int AW_HOR_POSITIVE = 0x0001;//自左向右显示窗口。该标志可以在滚动动画和滑动动画中使用。当使用AW_CENTER标志时,该标志将被忽略。
public const int AW_VER_POSITIVE = 0x0004;//自顶向下显示窗口。该标志可以在滚动动画和滑动动画中使用。当使用AW_CENTER标志时,该标志将被忽略。
public const int AW_HOR_NEGATIVE = 0x0002;//自右向左显示窗口。该标志可以在滚动动画和滑动动画中使用。当使用AW_CENTER标志时,该标志将被忽略。
public const int AW_VER_NEGATIVE = 0x0008;//自下向上显示窗口。该标志可以在滚动动画和滑动动画中使用。当使用AW_CENTER标志时,该标志将被忽略。
}
#endregion
}

+ 0
- 23
BWP.WinFormControl/WinApiSendMessage.cs View File

@ -1,23 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace BWP.WinFormControl
{
public class WinApiSendMessage
{
[DllImport("User32.dll", EntryPoint = "SendMessage")]
public static extern int SendMessage(
int hWnd, // handle to destination window
int Msg, // message
int wParam, // first message parameter
int lParam // second message parameter
);
[DllImport("User32.dll", EntryPoint = "FindWindow")]
public static extern int FindWindow(string lpClassName, string lpWindowName);
}
}

+ 1
- 1
ButcherWeight/WeightContext.cs View File

@ -15,7 +15,7 @@ namespace ButcherWeight
private static string loginConfigPath = @"C:\BwpB3Project\src\B3ButcherManageClient\ButcherManageClient\bin\Debug\WeightSetting.xml";
//#endif
//#if !debug
// private static string loginConfigPath = Application.StartupPath + "\\WeightSetting.xml";
// private static string loginConfigPath = Application.StartupPath + "\\WeightSetting.xml";
//#endif
private static WeightSetting _config;
public static WeightSetting Config


+ 183
- 172
ButcherWeight/WeightForm.Designer.cs View File

@ -30,21 +30,21 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle32 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle33 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle35 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle36 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle37 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle38 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle39 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle40 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle41 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle42 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle43 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle44 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle45 = 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();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
this.panel1 = new System.Windows.Forms.Panel();
this.enableCheckBox = new System.Windows.Forms.CheckBox();
this.weightSet = new System.Windows.Forms.Button();
@ -129,16 +129,6 @@
this.S_AbnormalItem_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.S_Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.billGrid = new System.Windows.Forms.DataGridView();
this.M_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_B3ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_Car_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_Supplier_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_Employee_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_PurchaseType_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_HouseNames = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_SanctionNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.label15 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.label17 = new System.Windows.Forms.Label();
@ -150,6 +140,17 @@
this.queryBtn = new System.Windows.Forms.Button();
this.qSupplierSelect = new BWP.WinFormControl.UComboBox();
this.qCarSelect = new BWP.WinFormControl.UComboBox();
this.M_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_B3ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_Car_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_Supplier_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_Employee_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_PurchaseType_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_HouseNames = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_SanctionNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_Remark = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.panel3.SuspendLayout();
@ -705,17 +706,17 @@
this.farmerGrid.AllowUserToDeleteRows = false;
this.farmerGrid.AllowUserToResizeColumns = false;
this.farmerGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle31.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.farmerGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle31;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.farmerGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.farmerGrid.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle32.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle32.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle32.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle32.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle32.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle32.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.farmerGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle32;
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.farmerGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.farmerGrid.ColumnHeadersHeight = 24;
this.farmerGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.farmerGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@ -731,8 +732,8 @@
this.farmerGrid.MultiSelect = false;
this.farmerGrid.Name = "farmerGrid";
this.farmerGrid.RowHeadersVisible = false;
dataGridViewCellStyle33.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.farmerGrid.RowsDefaultCellStyle = dataGridViewCellStyle33;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.farmerGrid.RowsDefaultCellStyle = dataGridViewCellStyle3;
this.farmerGrid.RowTemplate.Height = 23;
this.farmerGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.farmerGrid.Size = new System.Drawing.Size(400, 112);
@ -821,17 +822,17 @@
this.weightGrid.AllowUserToAddRows = false;
this.weightGrid.AllowUserToResizeColumns = false;
this.weightGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle34.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.weightGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle34;
dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.weightGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4;
this.weightGrid.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle35.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle35.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle35.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle35.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle35.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle35.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle35.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.weightGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle35;
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.weightGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5;
this.weightGrid.ColumnHeadersHeight = 24;
this.weightGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.weightGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@ -847,8 +848,8 @@
this.weightGrid.MultiSelect = false;
this.weightGrid.Name = "weightGrid";
this.weightGrid.RowHeadersVisible = false;
dataGridViewCellStyle36.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.weightGrid.RowsDefaultCellStyle = dataGridViewCellStyle36;
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.weightGrid.RowsDefaultCellStyle = dataGridViewCellStyle6;
this.weightGrid.RowTemplate.Height = 23;
this.weightGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.weightGrid.Size = new System.Drawing.Size(400, 90);
@ -929,17 +930,17 @@
this.houseGird.AllowUserToDeleteRows = false;
this.houseGird.AllowUserToResizeColumns = false;
this.houseGird.AllowUserToResizeRows = false;
dataGridViewCellStyle37.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.houseGird.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle37;
dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.houseGird.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7;
this.houseGird.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle38.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle38.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle38.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle38.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle38.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle38.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle38.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.houseGird.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle38;
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.houseGird.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8;
this.houseGird.ColumnHeadersHeight = 24;
this.houseGird.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.houseGird.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@ -954,8 +955,8 @@
this.houseGird.MultiSelect = false;
this.houseGird.Name = "houseGird";
this.houseGird.RowHeadersVisible = false;
dataGridViewCellStyle39.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.houseGird.RowsDefaultCellStyle = dataGridViewCellStyle39;
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.houseGird.RowsDefaultCellStyle = dataGridViewCellStyle9;
this.houseGird.RowTemplate.Height = 23;
this.houseGird.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.houseGird.Size = new System.Drawing.Size(400, 90);
@ -1018,17 +1019,17 @@
this.abnormalGrid.AllowUserToDeleteRows = false;
this.abnormalGrid.AllowUserToResizeColumns = false;
this.abnormalGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle40.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.abnormalGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle40;
dataGridViewCellStyle10.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.abnormalGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle10;
this.abnormalGrid.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle41.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle41.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle41.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle41.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle41.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle41.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle41.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.abnormalGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle41;
dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle11.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.abnormalGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11;
this.abnormalGrid.ColumnHeadersHeight = 24;
this.abnormalGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.abnormalGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@ -1044,8 +1045,8 @@
this.abnormalGrid.MultiSelect = false;
this.abnormalGrid.Name = "abnormalGrid";
this.abnormalGrid.RowHeadersVisible = false;
dataGridViewCellStyle42.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.abnormalGrid.RowsDefaultCellStyle = dataGridViewCellStyle42;
dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.abnormalGrid.RowsDefaultCellStyle = dataGridViewCellStyle12;
this.abnormalGrid.RowTemplate.Height = 23;
this.abnormalGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.abnormalGrid.Size = new System.Drawing.Size(400, 237);
@ -1114,17 +1115,17 @@
this.billGrid.AllowUserToDeleteRows = false;
this.billGrid.AllowUserToResizeColumns = false;
this.billGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle43.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.billGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle43;
dataGridViewCellStyle13.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.billGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13;
this.billGrid.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle44.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle44.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle44.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle44.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle44.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle44.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle44.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.billGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle44;
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.billGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14;
this.billGrid.ColumnHeadersHeight = 24;
this.billGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.billGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@ -1137,98 +1138,21 @@
this.M_Number,
this.M_Weight,
this.M_HouseNames,
this.M_SanctionNumber});
this.M_SanctionNumber,
this.M_Remark});
this.billGrid.Location = new System.Drawing.Point(12, 595);
this.billGrid.MultiSelect = false;
this.billGrid.Name = "billGrid";
this.billGrid.ReadOnly = true;
this.billGrid.RowHeadersVisible = false;
dataGridViewCellStyle45.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.billGrid.RowsDefaultCellStyle = dataGridViewCellStyle45;
dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.billGrid.RowsDefaultCellStyle = dataGridViewCellStyle15;
this.billGrid.RowTemplate.Height = 23;
this.billGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.billGrid.Size = new System.Drawing.Size(1250, 230);
this.billGrid.TabIndex = 0;
this.billGrid.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.billGrid_CellDoubleClick);
//
// M_ID
//
this.M_ID.DataPropertyName = "ID";
this.M_ID.HeaderText = "ID";
this.M_ID.Name = "M_ID";
this.M_ID.ReadOnly = true;
this.M_ID.Visible = false;
//
// M_B3ID
//
this.M_B3ID.DataPropertyName = "B3ID";
this.M_B3ID.HeaderText = "过磅单号";
this.M_B3ID.Name = "M_B3ID";
this.M_B3ID.ReadOnly = true;
//
// M_Car_Name
//
this.M_Car_Name.DataPropertyName = "Car_Name";
this.M_Car_Name.HeaderText = "车辆";
this.M_Car_Name.Name = "M_Car_Name";
this.M_Car_Name.ReadOnly = true;
this.M_Car_Name.Width = 120;
//
// M_Supplier_Name
//
this.M_Supplier_Name.DataPropertyName = "Supplier_Name";
this.M_Supplier_Name.HeaderText = "供应商";
this.M_Supplier_Name.Name = "M_Supplier_Name";
this.M_Supplier_Name.ReadOnly = true;
this.M_Supplier_Name.Width = 120;
//
// M_Employee_Name
//
this.M_Employee_Name.DataPropertyName = "Employee_Name";
this.M_Employee_Name.HeaderText = "业务员";
this.M_Employee_Name.Name = "M_Employee_Name";
this.M_Employee_Name.ReadOnly = true;
this.M_Employee_Name.Width = 120;
//
// M_PurchaseType_Name
//
this.M_PurchaseType_Name.DataPropertyName = "PurchaseType_Name";
this.M_PurchaseType_Name.HeaderText = "收购类型";
this.M_PurchaseType_Name.Name = "M_PurchaseType_Name";
this.M_PurchaseType_Name.ReadOnly = true;
this.M_PurchaseType_Name.Width = 120;
//
// M_Number
//
this.M_Number.DataPropertyName = "Number";
this.M_Number.HeaderText = "收购头数";
this.M_Number.Name = "M_Number";
this.M_Number.ReadOnly = true;
this.M_Number.Width = 120;
//
// M_Weight
//
this.M_Weight.DataPropertyName = "Weight";
this.M_Weight.HeaderText = "收购重量";
this.M_Weight.Name = "M_Weight";
this.M_Weight.ReadOnly = true;
this.M_Weight.Width = 120;
//
// M_HouseNames
//
this.M_HouseNames.DataPropertyName = "HouseNames";
this.M_HouseNames.HeaderText = "圈舍";
this.M_HouseNames.Name = "M_HouseNames";
this.M_HouseNames.ReadOnly = true;
this.M_HouseNames.Width = 180;
//
// M_SanctionNumber
//
this.M_SanctionNumber.DataPropertyName = "SanctionNumber";
this.M_SanctionNumber.HeaderText = "异常明细";
this.M_SanctionNumber.Name = "M_SanctionNumber";
this.M_SanctionNumber.ReadOnly = true;
//
// label15
//
this.label15.AutoSize = true;
@ -1339,6 +1263,92 @@
this.qCarSelect.Size = new System.Drawing.Size(135, 27);
this.qCarSelect.TabIndex = 40;
//
// M_ID
//
this.M_ID.DataPropertyName = "ID";
this.M_ID.HeaderText = "ID";
this.M_ID.Name = "M_ID";
this.M_ID.ReadOnly = true;
this.M_ID.Visible = false;
//
// M_B3ID
//
this.M_B3ID.DataPropertyName = "B3ID";
this.M_B3ID.HeaderText = "过磅单号";
this.M_B3ID.Name = "M_B3ID";
this.M_B3ID.ReadOnly = true;
//
// M_Car_Name
//
this.M_Car_Name.DataPropertyName = "Car_Name";
this.M_Car_Name.HeaderText = "车辆";
this.M_Car_Name.Name = "M_Car_Name";
this.M_Car_Name.ReadOnly = true;
this.M_Car_Name.Width = 120;
//
// M_Supplier_Name
//
this.M_Supplier_Name.DataPropertyName = "Supplier_Name";
this.M_Supplier_Name.HeaderText = "供应商";
this.M_Supplier_Name.Name = "M_Supplier_Name";
this.M_Supplier_Name.ReadOnly = true;
this.M_Supplier_Name.Width = 120;
//
// M_Employee_Name
//
this.M_Employee_Name.DataPropertyName = "Employee_Name";
this.M_Employee_Name.HeaderText = "业务员";
this.M_Employee_Name.Name = "M_Employee_Name";
this.M_Employee_Name.ReadOnly = true;
this.M_Employee_Name.Width = 110;
//
// M_PurchaseType_Name
//
this.M_PurchaseType_Name.DataPropertyName = "PurchaseType_Name";
this.M_PurchaseType_Name.HeaderText = "收购类型";
this.M_PurchaseType_Name.Name = "M_PurchaseType_Name";
this.M_PurchaseType_Name.ReadOnly = true;
this.M_PurchaseType_Name.Width = 110;
//
// M_Number
//
this.M_Number.DataPropertyName = "Number";
this.M_Number.HeaderText = "收购头数";
this.M_Number.Name = "M_Number";
this.M_Number.ReadOnly = true;
this.M_Number.Width = 110;
//
// M_Weight
//
this.M_Weight.DataPropertyName = "Weight";
this.M_Weight.HeaderText = "收购重量";
this.M_Weight.Name = "M_Weight";
this.M_Weight.ReadOnly = true;
this.M_Weight.Width = 120;
//
// M_HouseNames
//
this.M_HouseNames.DataPropertyName = "HouseNames";
this.M_HouseNames.HeaderText = "圈舍";
this.M_HouseNames.Name = "M_HouseNames";
this.M_HouseNames.ReadOnly = true;
this.M_HouseNames.Width = 180;
//
// M_SanctionNumber
//
this.M_SanctionNumber.DataPropertyName = "SanctionNumber";
this.M_SanctionNumber.HeaderText = "异常明细";
this.M_SanctionNumber.Name = "M_SanctionNumber";
this.M_SanctionNumber.ReadOnly = true;
//
// M_Remark
//
this.M_Remark.DataPropertyName = "Remark";
this.M_Remark.HeaderText = "摘要";
this.M_Remark.Name = "M_Remark";
this.M_Remark.ReadOnly = true;
this.M_Remark.Width = 130;
//
// WeightForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@ -1472,6 +1482,14 @@
private BWP.WinFormControl.UComboBox qSupplierSelect;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button queryBtn;
private System.Windows.Forms.DataGridViewTextBoxColumn F_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn F_B3ID;
private System.Windows.Forms.DataGridViewTextBoxColumn F_WeightBill_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn F_Farmer_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn F_Index;
private System.Windows.Forms.DataGridViewTextBoxColumn F_Farmer_Name;
private System.Windows.Forms.DataGridViewTextBoxColumn F_Number;
private System.Windows.Forms.DataGridViewTextBoxColumn F_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn M_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn M_B3ID;
private System.Windows.Forms.DataGridViewTextBoxColumn M_Car_Name;
@ -1482,13 +1500,6 @@
private System.Windows.Forms.DataGridViewTextBoxColumn M_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn M_HouseNames;
private System.Windows.Forms.DataGridViewTextBoxColumn M_SanctionNumber;
private System.Windows.Forms.DataGridViewTextBoxColumn F_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn F_B3ID;
private System.Windows.Forms.DataGridViewTextBoxColumn F_WeightBill_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn F_Farmer_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn F_Index;
private System.Windows.Forms.DataGridViewTextBoxColumn F_Farmer_Name;
private System.Windows.Forms.DataGridViewTextBoxColumn F_Number;
private System.Windows.Forms.DataGridViewTextBoxColumn F_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn M_Remark;
}
}

+ 3
- 0
ButcherWeight/WeightForm.resx View File

@ -240,6 +240,9 @@
<metadata name="M_SanctionNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="M_Remark.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="weightSerialPort.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>


BIN
Setup/Release/Setup.msi View File


+ 80
- 0
WeighAndGrading/GradeContext.cs View File

@ -0,0 +1,80 @@
using BO.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WeighAndGrading
{
public static class GradeContext
{
//#if debug
private static string loginConfigPath = @"C:\BwpB3Project\src\B3ButcherManageClient\ButcherManageClient\bin\Debug\GradeConfig.xml";
//#endif
//#if !debug
// private static string loginConfigPath = Application.StartupPath + "\\GradeConfig.xml";
//#endif
private static GradeConfig _config;
public static GradeConfig Config
{
get
{
if (_config == null)
_config = CreateConfig();
return _config;
}
}
static GradeConfig CreateConfig()
{
var config = new GradeConfig();
if (!File.Exists(loginConfigPath))
{
XmlUtil.SerializerObjToFile(config, loginConfigPath);
}
else
config = XmlUtil.DeserializeFromFile<GradeConfig>(loginConfigPath);
return config;
}
public static void Save()
{
if (string.IsNullOrEmpty(_config.WeightSet))
throw new Exception("请选择称型号");
if (string.IsNullOrEmpty(_config.ComSet))
throw new Exception("请选择Com口");
if (_config.RateSet == null)
throw new Exception("请选择波特率");
if (_config.BitSet == null)
throw new Exception("请选择数据位");
if (string.IsNullOrEmpty(_config.Format))
throw new Exception("请填写显示格式");
try
{
string.Format("{0:" + _config.Format + "}", 1);
}
catch (Exception ex)
{
throw new Exception("显示格式填写错误\n" + ex.Message);
}
XmlUtil.SerializerObjToFile(_config, loginConfigPath);
}
}
public class GradeConfig
{
public string WeightSet { get; set; }
public string ComSet { get; set; }
public int? RateSet { get; set; }
public int? BitSet { get; set; }
public string Format { get; set; }
public decimal? Discont { get; set; }
}
}

+ 581
- 154
WeighAndGrading/GradeFrom.Designer.cs View File

@ -28,35 +28,73 @@
/// </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 dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
this.label1 = new System.Windows.Forms.Label();
this.uDatePicker1 = new BWP.WinFormControl.UDatePicker();
this.button1 = new System.Windows.Forms.Button();
this.uDataGridView1 = new BWP.WinFormControl.UDataGridView();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.syncBtn = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.orderLabel = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.alreadyLabel = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.ttPanel = new System.Windows.Forms.FlowLayoutPanel();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.label11 = new System.Windows.Forms.Label();
this.mbPanel = new System.Windows.Forms.FlowLayoutPanel();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label12 = new System.Windows.Forms.Label();
this.queryPanel = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.maoRadio = new System.Windows.Forms.RadioButton();
this.tangRadio = new System.Windows.Forms.RadioButton();
this.allRadio = new System.Windows.Forms.RadioButton();
this.label9 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.queryBtn = new System.Windows.Forms.Button();
this.saiXuanBtn = new System.Windows.Forms.Button();
this.enableWeight = new System.Windows.Forms.CheckBox();
this.isPrintCheckBox = new System.Windows.Forms.CheckBox();
this.printBtn = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.lblChengZhong = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).BeginInit();
this.label10 = new System.Windows.Forms.Label();
this.orderInput = new BWP.WinFormControl.UTextBoxWithPad();
this.historyGrid = new BWP.WinFormControl.UDataGridView();
this.dataGridView = new BWP.WinFormControl.UDataGridView();
this.butcherTimeInput = new BWP.WinFormControl.UDatePicker();
this.beginDateInput = new BWP.WinFormControl.UDatePicker();
this.endDataInput = new BWP.WinFormControl.UDatePicker();
this.label3 = new System.Windows.Forms.Label();
this.closeBtn = new System.Windows.Forms.Button();
this.D_OrderDetail_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.D_Finish = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.D_Order = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.D_Technics_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.D_Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.D_Already = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.configBtn = new System.Windows.Forms.Button();
this.H_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Livestock_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Index = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Order = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Technics = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Livestock_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Time = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.queryPanel.SuspendLayout();
this.panel2.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.historyGrid)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout();
//
// label1
@ -69,177 +107,243 @@
this.label1.TabIndex = 0;
this.label1.Text = "宰杀日期:";
//
// uDatePicker1
//
this.uDatePicker1.BackColor = System.Drawing.Color.White;
this.uDatePicker1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.uDatePicker1.Date = new System.DateTime(2017, 9, 5, 0, 0, 0, 0);
this.uDatePicker1.Font = new System.Drawing.Font("宋体", 15F);
this.uDatePicker1.Location = new System.Drawing.Point(116, 126);
this.uDatePicker1.Name = "uDatePicker1";
this.uDatePicker1.Size = new System.Drawing.Size(133, 30);
this.uDatePicker1.TabIndex = 2;
this.uDatePicker1.Text = "2017/09/05";
this.uDatePicker1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.uDatePicker1.Type = BWP.WinFormControl.DateTimeType.Date;
//
// button1
//
this.button1.Font = new System.Drawing.Font("宋体", 15F);
this.button1.Location = new System.Drawing.Point(287, 120);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(102, 43);
this.button1.TabIndex = 3;
this.button1.Text = "同步数据";
this.button1.UseVisualStyleBackColor = true;
//
// 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.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.Column1,
this.Column2,
this.Column3,
this.Column4});
this.uDataGridView1.Location = new System.Drawing.Point(12, 175);
this.uDataGridView1.MultiSelect = false;
this.uDataGridView1.Name = "uDataGridView1";
this.uDataGridView1.ReadOnly = true;
this.uDataGridView1.RowHeadersVisible = false;
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(377, 480);
this.uDataGridView1.TabIndex = 4;
//
// Column1
//
this.Column1.HeaderText = "屠宰顺序";
this.Column1.Name = "Column1";
this.Column1.ReadOnly = true;
//
// Column2
//
this.Column2.HeaderText = "工艺";
this.Column2.Name = "Column2";
this.Column2.ReadOnly = true;
this.Column2.Width = 80;
//
// Column3
//
this.Column3.HeaderText = "头数";
this.Column3.Name = "Column3";
this.Column3.ReadOnly = true;
this.Column3.Width = 80;
//
// Column4
//
this.Column4.HeaderText = "已宰";
this.Column4.Name = "Column4";
this.Column4.ReadOnly = true;
this.Column4.Width = 80;
// syncBtn
//
this.syncBtn.Font = new System.Drawing.Font("宋体", 15F);
this.syncBtn.Location = new System.Drawing.Point(274, 120);
this.syncBtn.Name = "syncBtn";
this.syncBtn.Size = new System.Drawing.Size(102, 43);
this.syncBtn.TabIndex = 3;
this.syncBtn.Text = "同步数据";
this.syncBtn.UseVisualStyleBackColor = true;
this.syncBtn.Click += new System.EventHandler(this.syncBtn_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 15F);
this.label2.Location = new System.Drawing.Point(447, 101);
this.label2.Location = new System.Drawing.Point(413, 131);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(109, 20);
this.label2.TabIndex = 5;
this.label2.Text = "屠宰顺序:";
//
// label3
// orderLabel
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 15F);
this.label3.Location = new System.Drawing.Point(562, 101);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(19, 20);
this.label3.TabIndex = 6;
this.label3.Text = "0";
this.orderLabel.AutoSize = true;
this.orderLabel.Font = new System.Drawing.Font("宋体", 15F);
this.orderLabel.Location = new System.Drawing.Point(518, 131);
this.orderLabel.Name = "orderLabel";
this.orderLabel.Size = new System.Drawing.Size(19, 20);
this.orderLabel.TabIndex = 6;
this.orderLabel.Text = "0";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("宋体", 15F);
this.label4.Location = new System.Drawing.Point(617, 100);
this.label4.Location = new System.Drawing.Point(577, 131);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(69, 20);
this.label4.Size = new System.Drawing.Size(109, 20);
this.label4.TabIndex = 7;
this.label4.Text = "已宰:";
this.label4.Text = "已宰头数:";
//
// label5
// alreadyLabel
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("宋体", 15F);
this.label5.Location = new System.Drawing.Point(702, 100);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(19, 20);
this.label5.TabIndex = 8;
this.label5.Text = "0";
this.alreadyLabel.AutoSize = true;
this.alreadyLabel.Font = new System.Drawing.Font("宋体", 15F);
this.alreadyLabel.Location = new System.Drawing.Point(692, 131);
this.alreadyLabel.Name = "alreadyLabel";
this.alreadyLabel.Size = new System.Drawing.Size(19, 20);
this.alreadyLabel.TabIndex = 8;
this.alreadyLabel.Text = "0";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.flowLayoutPanel1);
this.groupBox1.Location = new System.Drawing.Point(439, 154);
this.groupBox1.Controls.Add(this.ttPanel);
this.groupBox1.Location = new System.Drawing.Point(407, 175);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(345, 288);
this.groupBox1.Size = new System.Drawing.Size(390, 330);
this.groupBox1.TabIndex = 9;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "烫褪";
//
// ttPanel
//
this.ttPanel.Location = new System.Drawing.Point(13, 36);
this.ttPanel.Name = "ttPanel";
this.ttPanel.Size = new System.Drawing.Size(367, 276);
this.ttPanel.TabIndex = 0;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.flowLayoutPanel2);
this.groupBox2.Location = new System.Drawing.Point(439, 473);
this.groupBox2.Controls.Add(this.label11);
this.groupBox2.Controls.Add(this.mbPanel);
this.groupBox2.Location = new System.Drawing.Point(407, 525);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(345, 332);
this.groupBox2.Size = new System.Drawing.Size(390, 330);
this.groupBox2.TabIndex = 10;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "毛剥";
//
// flowLayoutPanel1
// label11
//
this.flowLayoutPanel1.Location = new System.Drawing.Point(12, 21);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(319, 251);
this.flowLayoutPanel1.TabIndex = 0;
this.label11.AutoSize = true;
this.label11.Font = new System.Drawing.Font("宋体", 15F);
this.label11.Location = new System.Drawing.Point(6, -1);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(49, 20);
this.label11.TabIndex = 32;
this.label11.Text = "毛剥";
//
// flowLayoutPanel2
// mbPanel
//
this.flowLayoutPanel2.Location = new System.Drawing.Point(12, 32);
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
this.flowLayoutPanel2.Size = new System.Drawing.Size(319, 251);
this.flowLayoutPanel2.TabIndex = 1;
this.mbPanel.Location = new System.Drawing.Point(13, 37);
this.mbPanel.Name = "mbPanel";
this.mbPanel.Size = new System.Drawing.Size(367, 276);
this.mbPanel.TabIndex = 1;
//
// groupBox3
//
this.groupBox3.Location = new System.Drawing.Point(853, 154);
this.groupBox3.Controls.Add(this.label12);
this.groupBox3.Controls.Add(this.queryPanel);
this.groupBox3.Controls.Add(this.queryBtn);
this.groupBox3.Controls.Add(this.saiXuanBtn);
this.groupBox3.Controls.Add(this.historyGrid);
this.groupBox3.Location = new System.Drawing.Point(826, 175);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(384, 651);
this.groupBox3.Size = new System.Drawing.Size(438, 680);
this.groupBox3.TabIndex = 11;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "记录";
//
// label12
//
this.label12.AutoSize = true;
this.label12.Font = new System.Drawing.Font("宋体", 15F);
this.label12.Location = new System.Drawing.Point(5, -1);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(49, 20);
this.label12.TabIndex = 32;
this.label12.Text = "记录";
//
// queryPanel
//
this.queryPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.queryPanel.Controls.Add(this.label3);
this.queryPanel.Controls.Add(this.endDataInput);
this.queryPanel.Controls.Add(this.beginDateInput);
this.queryPanel.Controls.Add(this.panel2);
this.queryPanel.Controls.Add(this.orderInput);
this.queryPanel.Controls.Add(this.label9);
this.queryPanel.Controls.Add(this.label6);
this.queryPanel.Controls.Add(this.label8);
this.queryPanel.Location = new System.Drawing.Point(23, 85);
this.queryPanel.Name = "queryPanel";
this.queryPanel.Size = new System.Drawing.Size(391, 172);
this.queryPanel.TabIndex = 26;
//
// panel2
//
this.panel2.Controls.Add(this.maoRadio);
this.panel2.Controls.Add(this.tangRadio);
this.panel2.Controls.Add(this.allRadio);
this.panel2.Location = new System.Drawing.Point(114, 62);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(268, 31);
this.panel2.TabIndex = 9;
//
// maoRadio
//
this.maoRadio.AutoSize = true;
this.maoRadio.Font = new System.Drawing.Font("宋体", 14F);
this.maoRadio.Location = new System.Drawing.Point(199, 5);
this.maoRadio.Name = "maoRadio";
this.maoRadio.Size = new System.Drawing.Size(65, 23);
this.maoRadio.TabIndex = 11;
this.maoRadio.TabStop = true;
this.maoRadio.Text = "毛剥";
this.maoRadio.UseVisualStyleBackColor = true;
//
// tangRadio
//
this.tangRadio.AutoSize = true;
this.tangRadio.Font = new System.Drawing.Font("宋体", 15F);
this.tangRadio.Location = new System.Drawing.Point(98, 4);
this.tangRadio.Name = "tangRadio";
this.tangRadio.Size = new System.Drawing.Size(67, 24);
this.tangRadio.TabIndex = 10;
this.tangRadio.TabStop = true;
this.tangRadio.Text = "烫褪";
this.tangRadio.UseVisualStyleBackColor = true;
//
// allRadio
//
this.allRadio.AutoSize = true;
this.allRadio.Font = new System.Drawing.Font("宋体", 14F);
this.allRadio.Location = new System.Drawing.Point(8, 5);
this.allRadio.Name = "allRadio";
this.allRadio.Size = new System.Drawing.Size(65, 23);
this.allRadio.TabIndex = 9;
this.allRadio.TabStop = true;
this.allRadio.Text = "全部";
this.allRadio.UseVisualStyleBackColor = true;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Font = new System.Drawing.Font("宋体", 15F);
this.label9.Location = new System.Drawing.Point(13, 69);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(69, 20);
this.label9.TabIndex = 0;
this.label9.Text = "工艺:";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("宋体", 15F);
this.label6.Location = new System.Drawing.Point(13, 20);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(109, 20);
this.label6.TabIndex = 0;
this.label6.Text = "屠宰顺序:";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("宋体", 15F);
this.label8.Location = new System.Drawing.Point(244, 121);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(19, 20);
this.label8.TabIndex = 5;
this.label8.Text = "-";
//
// queryBtn
//
this.queryBtn.Font = new System.Drawing.Font("宋体", 15F);
this.queryBtn.Location = new System.Drawing.Point(245, 36);
this.queryBtn.Name = "queryBtn";
this.queryBtn.Size = new System.Drawing.Size(102, 43);
this.queryBtn.TabIndex = 5;
this.queryBtn.Text = "查询";
this.queryBtn.UseVisualStyleBackColor = true;
this.queryBtn.Click += new System.EventHandler(this.queryBtn_Click);
//
// saiXuanBtn
//
this.saiXuanBtn.Font = new System.Drawing.Font("宋体", 15F);
this.saiXuanBtn.Location = new System.Drawing.Point(98, 36);
this.saiXuanBtn.Name = "saiXuanBtn";
this.saiXuanBtn.Size = new System.Drawing.Size(102, 43);
this.saiXuanBtn.TabIndex = 4;
this.saiXuanBtn.Text = "筛选";
this.saiXuanBtn.UseVisualStyleBackColor = true;
this.saiXuanBtn.Click += new System.EventHandler(this.saiXuanBtn_Click);
//
// enableWeight
//
this.enableWeight.AutoCheck = false;
this.enableWeight.AutoSize = true;
this.enableWeight.Font = new System.Drawing.Font("宋体", 15F);
this.enableWeight.Location = new System.Drawing.Point(10, 91);
@ -248,12 +352,13 @@
this.enableWeight.TabIndex = 31;
this.enableWeight.Text = "启用称重";
this.enableWeight.UseVisualStyleBackColor = true;
this.enableWeight.Click += new System.EventHandler(this.enableWeight_Click);
//
// isPrintCheckBox
//
this.isPrintCheckBox.AutoSize = true;
this.isPrintCheckBox.Font = new System.Drawing.Font("宋体", 15F);
this.isPrintCheckBox.Location = new System.Drawing.Point(281, 2);
this.isPrintCheckBox.Location = new System.Drawing.Point(268, 2);
this.isPrintCheckBox.Name = "isPrintCheckBox";
this.isPrintCheckBox.Size = new System.Drawing.Size(108, 24);
this.isPrintCheckBox.TabIndex = 30;
@ -263,12 +368,13 @@
// printBtn
//
this.printBtn.Font = new System.Drawing.Font("宋体", 15F);
this.printBtn.Location = new System.Drawing.Point(287, 37);
this.printBtn.Location = new System.Drawing.Point(274, 37);
this.printBtn.Name = "printBtn";
this.printBtn.Size = new System.Drawing.Size(102, 43);
this.printBtn.TabIndex = 29;
this.printBtn.Text = "打印测试";
this.printBtn.UseVisualStyleBackColor = true;
this.printBtn.Click += new System.EventHandler(this.printBtn_Click);
//
// panel1
//
@ -290,11 +396,293 @@
this.lblChengZhong.TabIndex = 0;
this.lblChengZhong.Text = "0.00";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Font = new System.Drawing.Font("宋体", 15F);
this.label10.Location = new System.Drawing.Point(413, 171);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(49, 20);
this.label10.TabIndex = 32;
this.label10.Text = "烫褪";
//
// orderInput
//
this.orderInput.Font = new System.Drawing.Font("宋体", 15F);
this.orderInput.Location = new System.Drawing.Point(124, 17);
this.orderInput.Name = "orderInput";
this.orderInput.Size = new System.Drawing.Size(117, 30);
this.orderInput.TabIndex = 1;
this.orderInput.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Number;
//
// historyGrid
//
this.historyGrid.AllowUserToAddRows = false;
this.historyGrid.AllowUserToDeleteRows = false;
this.historyGrid.AllowUserToResizeColumns = false;
this.historyGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.historyGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.historyGrid.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.historyGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.historyGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.historyGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.H_ID,
this.H_Livestock_ID,
this.H_Index,
this.H_Order,
this.H_Technics,
this.H_Livestock_Name,
this.H_Weight,
this.H_Time});
this.historyGrid.Location = new System.Drawing.Point(6, 92);
this.historyGrid.MultiSelect = false;
this.historyGrid.Name = "historyGrid";
this.historyGrid.ReadOnly = true;
this.historyGrid.RowHeadersVisible = false;
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.historyGrid.RowsDefaultCellStyle = dataGridViewCellStyle4;
this.historyGrid.RowTemplate.Height = 40;
this.historyGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.historyGrid.Size = new System.Drawing.Size(426, 571);
this.historyGrid.TabIndex = 0;
//
// dataGridView
//
this.dataGridView.AllowUserToAddRows = false;
this.dataGridView.AllowUserToDeleteRows = false;
this.dataGridView.AllowUserToResizeColumns = false;
this.dataGridView.AllowUserToResizeRows = false;
dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.dataGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle5;
this.dataGridView.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle6;
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.D_OrderDetail_ID,
this.D_Finish,
this.D_Order,
this.D_Technics_Name,
this.D_Number,
this.D_Already});
this.dataGridView.Location = new System.Drawing.Point(12, 175);
this.dataGridView.Name = "dataGridView";
this.dataGridView.ReadOnly = true;
this.dataGridView.RowHeadersVisible = false;
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.dataGridView.RowsDefaultCellStyle = dataGridViewCellStyle7;
this.dataGridView.RowTemplate.Height = 30;
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dataGridView.Size = new System.Drawing.Size(364, 517);
this.dataGridView.TabIndex = 4;
//
// butcherTimeInput
//
this.butcherTimeInput.BackColor = System.Drawing.Color.White;
this.butcherTimeInput.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.butcherTimeInput.Date = new System.DateTime(2017, 9, 5, 0, 0, 0, 0);
this.butcherTimeInput.Font = new System.Drawing.Font("宋体", 15F);
this.butcherTimeInput.Location = new System.Drawing.Point(116, 126);
this.butcherTimeInput.Name = "butcherTimeInput";
this.butcherTimeInput.Size = new System.Drawing.Size(133, 30);
this.butcherTimeInput.TabIndex = 2;
this.butcherTimeInput.Text = "2017/09/05";
this.butcherTimeInput.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.butcherTimeInput.Type = BWP.WinFormControl.DateTimeType.Date;
//
// beginDateInput
//
this.beginDateInput.BackColor = System.Drawing.Color.White;
this.beginDateInput.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.beginDateInput.Date = new System.DateTime(2017, 9, 5, 0, 0, 0, 0);
this.beginDateInput.Font = new System.Drawing.Font("宋体", 15F);
this.beginDateInput.Location = new System.Drawing.Point(124, 115);
this.beginDateInput.Name = "beginDateInput";
this.beginDateInput.Size = new System.Drawing.Size(117, 30);
this.beginDateInput.TabIndex = 10;
this.beginDateInput.Text = "2017/9/5";
this.beginDateInput.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.beginDateInput.Type = BWP.WinFormControl.DateTimeType.Date;
//
// endDataInput
//
this.endDataInput.BackColor = System.Drawing.Color.White;
this.endDataInput.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.endDataInput.Date = new System.DateTime(2017, 9, 5, 0, 0, 0, 0);
this.endDataInput.Font = new System.Drawing.Font("宋体", 15F);
this.endDataInput.Location = new System.Drawing.Point(265, 115);
this.endDataInput.Name = "endDataInput";
this.endDataInput.Size = new System.Drawing.Size(117, 30);
this.endDataInput.TabIndex = 11;
this.endDataInput.Text = "2017/9/5";
this.endDataInput.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.endDataInput.Type = BWP.WinFormControl.DateTimeType.Date;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 15F);
this.label3.Location = new System.Drawing.Point(13, 120);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(109, 20);
this.label3.TabIndex = 12;
this.label3.Text = "屠宰时间:";
//
// closeBtn
//
this.closeBtn.Font = new System.Drawing.Font("宋体", 15F);
this.closeBtn.Location = new System.Drawing.Point(1156, 12);
this.closeBtn.Name = "closeBtn";
this.closeBtn.Size = new System.Drawing.Size(102, 43);
this.closeBtn.TabIndex = 33;
this.closeBtn.Text = "关闭";
this.closeBtn.UseVisualStyleBackColor = true;
this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click);
//
// D_OrderDetail_ID
//
this.D_OrderDetail_ID.DataPropertyName = "OrderDetail_ID";
this.D_OrderDetail_ID.HeaderText = "OrderDetail_ID";
this.D_OrderDetail_ID.Name = "D_OrderDetail_ID";
this.D_OrderDetail_ID.ReadOnly = true;
this.D_OrderDetail_ID.Visible = false;
//
// D_Finish
//
this.D_Finish.DataPropertyName = "Finish";
this.D_Finish.HeaderText = "Finish";
this.D_Finish.Name = "D_Finish";
this.D_Finish.ReadOnly = true;
this.D_Finish.Visible = false;
//
// D_Order
//
this.D_Order.DataPropertyName = "Order";
this.D_Order.HeaderText = "屠宰顺序";
this.D_Order.Name = "D_Order";
this.D_Order.ReadOnly = true;
//
// D_Technics_Name
//
this.D_Technics_Name.DataPropertyName = "Technics_Name";
this.D_Technics_Name.HeaderText = "工艺";
this.D_Technics_Name.Name = "D_Technics_Name";
this.D_Technics_Name.ReadOnly = true;
this.D_Technics_Name.Width = 80;
//
// D_Number
//
this.D_Number.DataPropertyName = "Number";
this.D_Number.HeaderText = "头数";
this.D_Number.Name = "D_Number";
this.D_Number.ReadOnly = true;
this.D_Number.Width = 80;
//
// D_Already
//
this.D_Already.DataPropertyName = "Already";
this.D_Already.HeaderText = "已宰";
this.D_Already.Name = "D_Already";
this.D_Already.ReadOnly = true;
this.D_Already.Width = 80;
//
// configBtn
//
this.configBtn.Font = new System.Drawing.Font("宋体", 15F);
this.configBtn.Location = new System.Drawing.Point(1036, 12);
this.configBtn.Name = "configBtn";
this.configBtn.Size = new System.Drawing.Size(102, 43);
this.configBtn.TabIndex = 34;
this.configBtn.Text = "设置";
this.configBtn.UseVisualStyleBackColor = true;
this.configBtn.Click += new System.EventHandler(this.configBtn_Click);
//
// H_ID
//
this.H_ID.DataPropertyName = "ID";
this.H_ID.HeaderText = "ID";
this.H_ID.Name = "H_ID";
this.H_ID.ReadOnly = true;
this.H_ID.Visible = false;
//
// H_Livestock_ID
//
this.H_Livestock_ID.HeaderText = "Livestock_ID";
this.H_Livestock_ID.Name = "H_Livestock_ID";
this.H_Livestock_ID.ReadOnly = true;
this.H_Livestock_ID.Visible = false;
//
// H_Index
//
this.H_Index.DataPropertyName = "Index";
this.H_Index.HeaderText = "序号";
this.H_Index.Name = "H_Index";
this.H_Index.ReadOnly = true;
this.H_Index.Width = 65;
//
// H_Order
//
this.H_Order.DataPropertyName = "Order";
this.H_Order.HeaderText = "屠宰顺序";
this.H_Order.Name = "H_Order";
this.H_Order.ReadOnly = true;
this.H_Order.Width = 95;
//
// H_Technics
//
this.H_Technics.DataPropertyName = "Technics_Name";
this.H_Technics.HeaderText = "工艺";
this.H_Technics.Name = "H_Technics";
this.H_Technics.ReadOnly = true;
this.H_Technics.Width = 65;
//
// H_Livestock_Name
//
this.H_Livestock_Name.DataPropertyName = "Livestock_Name";
this.H_Livestock_Name.HeaderText = "级别";
this.H_Livestock_Name.Name = "H_Livestock_Name";
this.H_Livestock_Name.ReadOnly = true;
this.H_Livestock_Name.Width = 90;
//
// H_Weight
//
this.H_Weight.DataPropertyName = "Weight";
dataGridViewCellStyle3.Format = "#0.######";
this.H_Weight.DefaultCellStyle = dataGridViewCellStyle3;
this.H_Weight.HeaderText = "重量";
this.H_Weight.Name = "H_Weight";
this.H_Weight.ReadOnly = true;
this.H_Weight.Width = 65;
//
// H_Time
//
this.H_Time.DataPropertyName = "Time";
this.H_Time.HeaderText = "时间";
this.H_Time.Name = "H_Time";
this.H_Time.ReadOnly = true;
//
// GradeFrom
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1276, 865);
this.Controls.Add(this.configBtn);
this.Controls.Add(this.closeBtn);
this.Controls.Add(this.label10);
this.Controls.Add(this.enableWeight);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.isPrintCheckBox);
@ -302,24 +690,33 @@
this.Controls.Add(this.printBtn);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.panel1);
this.Controls.Add(this.label5);
this.Controls.Add(this.alreadyLabel);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.orderLabel);
this.Controls.Add(this.label2);
this.Controls.Add(this.uDataGridView1);
this.Controls.Add(this.button1);
this.Controls.Add(this.uDatePicker1);
this.Controls.Add(this.dataGridView);
this.Controls.Add(this.syncBtn);
this.Controls.Add(this.butcherTimeInput);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "GradeFrom";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "称重定级";
((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).EndInit();
this.Load += new System.EventHandler(this.GradeFrom_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.queryPanel.ResumeLayout(false);
this.queryPanel.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.historyGrid)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -328,26 +725,56 @@
#endregion
private System.Windows.Forms.Label label1;
private BWP.WinFormControl.UDatePicker uDatePicker1;
private System.Windows.Forms.Button button1;
private BWP.WinFormControl.UDataGridView uDataGridView1;
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
private System.Windows.Forms.DataGridViewTextBoxColumn Column4;
private BWP.WinFormControl.UDatePicker butcherTimeInput;
private System.Windows.Forms.Button syncBtn;
private BWP.WinFormControl.UDataGridView dataGridView;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label orderLabel;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label alreadyLabel;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.FlowLayoutPanel ttPanel;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
private System.Windows.Forms.FlowLayoutPanel mbPanel;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.CheckBox enableWeight;
private System.Windows.Forms.CheckBox isPrintCheckBox;
private System.Windows.Forms.Button printBtn;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label lblChengZhong;
private System.Windows.Forms.Panel queryPanel;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label12;
private BWP.WinFormControl.UTextBoxWithPad orderInput;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Button queryBtn;
private System.Windows.Forms.Button saiXuanBtn;
private BWP.WinFormControl.UDataGridView historyGrid;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.RadioButton maoRadio;
private System.Windows.Forms.RadioButton tangRadio;
private System.Windows.Forms.RadioButton allRadio;
private BWP.WinFormControl.UDatePicker beginDateInput;
private BWP.WinFormControl.UDatePicker endDataInput;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button closeBtn;
private System.Windows.Forms.DataGridViewTextBoxColumn D_OrderDetail_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn D_Finish;
private System.Windows.Forms.DataGridViewTextBoxColumn D_Order;
private System.Windows.Forms.DataGridViewTextBoxColumn D_Technics_Name;
private System.Windows.Forms.DataGridViewTextBoxColumn D_Number;
private System.Windows.Forms.DataGridViewTextBoxColumn D_Already;
private System.Windows.Forms.Button configBtn;
private System.Windows.Forms.DataGridViewTextBoxColumn H_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Index;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Order;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Technics;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_Name;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Time;
}
}

+ 482
- 2
WeighAndGrading/GradeFrom.cs View File

@ -1,20 +1,500 @@
using System;
using BO;
using BO.BO.Bill;
using BO.Utils;
using BO.Utils.BillRpc;
using BWP.WinFormControl;
using BWP.WinFormControl.WeightDataFormat;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WeighAndGrading
{
public partial class GradeFrom : Form
public partial class GradeFrom : Form, IAfterLogin
{
#region IAfterLogin
public string RoleName
{
get { return "定级员"; }
}
public Form Generate()
{
return this;
}
#endregion
private delegate void InvokeHandler();
List<GradeAndWeight> list;
List<GradeAndWeight_Detail> details;
SerialPort weightPort;
int maxIndex = 0;
Thread syncWegithThread;
readonly ConcurrentQueue<long> _detailQueue = new ConcurrentQueue<long>();
readonly ConcurrentQueue<decimal> _weightQueue = new ConcurrentQueue<decimal>();
#region weightNeed
private IDataFormat _dataFormat;
private Thread _inQueryThread, _outQueryThread;
private bool _mainProcessIsRun;
readonly StringBuilder _dataStrBuilder = new StringBuilder();
readonly ConcurrentQueue<string> _dataQueue = new ConcurrentQueue<string>();
private const int WmUpdDisplayMessage = 0x0500 + 2;
private string _displayValue;
private int _mainHandle;
#endregion
int MainHandle
{
get
{
if (_mainHandle == 0)
{
_mainHandle = WinApiSendMessage.FindWindow(null, this.Text);
}
return _mainHandle;
}
}
public GradeFrom()
{
InitializeComponent();
butcherTimeInput.Date = beginDateInput.Date = endDataInput.Date = DateTime.Today;
dataGridView.AutoGenerateColumns = false;
dataGridView.DataSource = null;
historyGrid.AutoGenerateColumns = false;
historyGrid.DataSource = null;
AddLivestockBtn();
weightPort = new SerialPort();
syncWegithThread = new Thread(SyncTask) { IsBackground = true };
this.FormClosing += delegate
{
if (syncWegithThread.IsAlive)
syncWegithThread.Abort();
if (_inQueryThread != null && _inQueryThread.IsAlive)
DisableWeight();
};
}
private void SyncTask()
{
while (_mainProcessIsRun)
{
if (_detailQueue.Any() && _weightQueue.Any())
{
long id;
decimal weight;
if (_detailQueue.TryDequeue(out id) && _weightQueue.TryDequeue(out weight))
{
GradeAndWeightRpc.FillDetailWeight(id, weight);
var first = details.FirstOrDefault(x => x.ID == id);
if (first != null)
{
first.Weight = weight;
this.Invoke(new InvokeHandler(delegate()
{
historyGrid.Refresh();
}));
}
}
}
else
Thread.Sleep(1000);
}
}
void AddLivestockBtn()
{
var livestocks = BaseInfoRpcUtil.GetLivestockList();
foreach (var item in livestocks)
{
var btn = new Button() { Name = "_" + item.Item1, Text = item.Item2, Tag = item, Size = new Size(70, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
btn.Click += (sender, e) =>
{
var selectRows = GetEnableTopTowRows();
if (selectRows.Count == 0)
throw new Exception("没有可定级的数据记录了");
var livestock = (CTuple<long, string, short>)btn.Tag;
var tech = livestock.Item3 == 0 ? "烫褪" : "毛剥";
var targetRow = selectRows.FirstOrDefault(x => x.Cells["D_Technics_Name"].Value.ToString() == tech);
if (targetRow == null)
throw new Exception(string.Format("没有 {0} 的数据可操作", tech));
var currentRow = targetRow.DataBoundItem as GradeAndWeight;
maxIndex += 1;
var entity = new GradeAndWeight_Detail();
entity.Index = maxIndex;
entity.OrderDetail_ID = currentRow.OrderDetail_ID;
entity.Order = currentRow.Order;
entity.Livestock_ID = livestock.Item1;
entity.Livestock_Name = livestock.Item2;
entity.Technics = livestock.Item3;
entity.Technics_Name = livestock.Item3 == 0 ? "烫褪" : "毛剥";
entity.Time = DateTime.Now;
details.Insert(0, entity);
GradeAndWeightRpc.InsertDetail(entity);
_detailQueue.Enqueue(entity.ID);
currentRow.Already = currentRow.Already + 1;
BindDataGrid();
historyGrid.DataSource = null;
historyGrid.DataSource = details;
historyGrid.Refresh();
//var name = livestock.Technics == 0 ? "带皮白条" : "去皮白条";
//Print(name, entity.Index);
};
if (item.Item3 == 0)
ttPanel.Controls.Add(btn);
else
mbPanel.Controls.Add(btn);
}
}
bool queryPanelShow = false;
private void saiXuanBtn_Click(object sender, EventArgs e)
{
if (queryPanelShow)
Animate.AnimateWindow(queryPanel.Handle, 200, Animate.AW_HIDE + Animate.AW_VER_NEGATIVE);
else
Animate.AnimateWindow(queryPanel.Handle, 200, Animate.AW_SLIDE + Animate.AW_VER_POSITIVE);
queryPanelShow = !queryPanelShow;
}
private void queryBtn_Click(object sender, EventArgs e)
{
if (queryPanelShow)
{
Animate.AnimateWindow(queryPanel.Handle, 200, Animate.AW_HIDE + Animate.AW_VER_NEGATIVE);
queryPanelShow = !queryPanelShow;
}
int? order = null;
if (!string.IsNullOrEmpty(orderInput.Text))
{
int v;
if (int.TryParse(orderInput.Text, out v))
order = v;
}
int type = -1;
if (tangRadio.Checked)
type = 0;
else if (maoRadio.Checked)
type = 1;
details = GradeAndWeightRpc.GetDetails(beginDateInput.Date.Value, beginDateInput.Date.Value, order, type);
historyGrid.DataSource = null;
if (details.Any())
historyGrid.DataSource = details;
historyGrid.Refresh();
}
private void GradeFrom_Load(object sender, EventArgs e)
{
queryPanel.Hide();
}
private void closeBtn_Click(object sender, EventArgs e)
{
this.Close();
}
private void syncBtn_Click(object sender, EventArgs e)
{
var date = butcherTimeInput.Date.Value;
list = GradeAndWeightRpc.GetGradeAndWeightList(date);
BindDataGrid();
details = GradeAndWeightRpc.GetDetails(date, date, null, -1);
BindDetailGrid();
if (details.Any())
maxIndex = details.First().Index;
}
void BindDataGrid()
{
dataGridView.DataSource = list.OrderBy(x => new { x.Finish, x.Order }).ToList();
foreach (DataGridViewRow row in dataGridView.Rows)
{
if ((bool)row.Cells["D_Finish"].Value)
row.DefaultCellStyle.BackColor = Color.YellowGreen;
}
var selectRows = GetEnableTopTowRows();
if (selectRows.Any())
{
var first = selectRows.First().DataBoundItem as GradeAndWeight;
orderLabel.Text = first.Order.ToString();
alreadyLabel.Text = first.Already.ToString();
}
else
{
orderLabel.Text = alreadyLabel.Text = string.Empty;
dataGridView.ClearSelection();
}
dataGridView.Refresh();
}
void BindDetailGrid()
{
historyGrid.DataSource = details;
historyGrid.Refresh();
}
//void BindSelectColor(GradeAndWeight entity)
//{
// if (entity.Finish)
// dataGridView.RowsDefaultCellStyle.SelectionBackColor = Color.FromArgb(204, 51, 51);
// else
// dataGridView.RowsDefaultCellStyle.SelectionBackColor = Color.FromArgb(66, 163, 218);
//}
private void printBtn_Click(object sender, EventArgs e)
{
var entity = new PrintEntity();
entity.AccountingUnit_Name = "青花瓷软件(北京)有限公司";
entity.Goods_Name = "B2/B3 ERP";
entity.Date = DateTime.Today;
entity.Checker = "管理员";
entity.StoreCondition = "0-4℃ 5日";
entity.Place = "北京市海淀区";
entity.TelNumber = "010-62701591";
entity.Address = "北京市北京市海淀区知春路49号";
entity.BarCode = string.Format("BWP{0}{1:00000}", DateTime.Today.ToString("yyyyMMdd"), new Random().Next(1, 1000));
entity._2DQRCode = string.Format("http://www.bwpsoft.com?code={0}", entity.BarCode);
PrintAPI.Print(entity);
}
private void configBtn_Click(object sender, EventArgs e)
{
new GradeSettingFrom().ShowDialog();
}
List<DataGridViewRow> GetEnableTopTowRows()
{
var result = new List<DataGridViewRow>();
if (dataGridView.Rows.Count == 0)
return result;
string top = string.Empty;
for (var i = 0; i <= dataGridView.Rows.Count - 1; i++)
{
var row = dataGridView.Rows[i];
if ((bool)row.Cells["D_Finish"].Value)
break;
var tv = row.Cells["D_Technics_Name"].Value.ToString();
if (tv != top)
{
row.Selected = true;
result.Add(row);
if (result.Count == 2)
break;
}
top = tv;
if (i == 2)
break;
}
return result;
}
#region weightNeed
void OpenSerialPort()
{
if (enableWeight.Checked)
return;
if (GradeContext.Config.RateSet == null)
throw new Exception("请先配置称相关信息");
weightPort.PortName = GradeContext.Config.ComSet;
weightPort.BaudRate = GradeContext.Config.RateSet.Value;
weightPort.DataBits = GradeContext.Config.BitSet.Value;
weightPort.ReadBufferSize = 4096 * 100;
if (!string.IsNullOrEmpty(GradeContext.Config.Format))
format = "{0:{format}}".Replace("{format}", GradeContext.Config.Format);
switch (GradeContext.Config.WeightSet)
{
case "IND560":
_dataFormat = new IND560DataFormat();
break;
case "Xk3124":
_dataFormat = new Xk3124DataFormat();
break;
case "Xk3190A9":
_dataFormat = new Xk3190A9DataFormat();
break;
default:
_dataFormat = new Xk3190D10DataFormat();
break;
}
if (!weightPort.IsOpen)
{
try
{
weightPort.Open();
}
catch (InvalidOperationException)
{
MessageBox.Show(@"指定的端口已打开");
}
catch (UnauthorizedAccessException)
{
MessageBox.Show(@"对端口的访问被拒绝");
}
}
}
void ReadData()
{
_inQueryThread = new Thread(InQuery);
_inQueryThread.Start();
_outQueryThread = new Thread(OutQuery);
_outQueryThread.Start();
}
string format = "{0:0.00}";
private void InQuery()
{
while (_mainProcessIsRun)
{
int availableCount = weightPort.BytesToRead;
if (availableCount == 0)
{
Thread.Sleep(1);
}
char[] buffer = new char[availableCount];
if (!weightPort.IsOpen)
{
continue;
}
weightPort.Read(buffer, 0, availableCount);
foreach (var c in buffer)
{
if (c == _dataFormat.Beginchar)
{
_dataStrBuilder.Clear();
_dataStrBuilder.Append(c);
}
else if (c == _dataFormat.Endchar || _dataStrBuilder.Length > _dataFormat.Bufsize)
{
_dataStrBuilder.Append(c);
_dataQueue.Enqueue(_dataStrBuilder.ToString());
_dataStrBuilder.Clear();
}
else
{
_dataStrBuilder.Append(c);
}
}
}
}
private void OutQuery()
{
while (_mainProcessIsRun)
{
try
{
bool isStatic;
string str;
string subStr;
if (!_dataQueue.TryDequeue(out subStr))
{
Thread.Sleep(1);
continue;
}
// 解析接受的端口数据
if (_dataFormat.ParseAscii(subStr, out str, out isStatic))
{
if (string.IsNullOrEmpty(str))
str = "0";
_displayValue = string.Format(format, decimal.Parse(str));
if (str != "0")
_weightQueue.Enqueue(decimal.Parse(_displayValue));
WinApiSendMessage.SendMessage(MainHandle, WmUpdDisplayMessage, 0, 0);
}
}
catch (Exception)
{
Thread.Sleep(1000);
continue;
}
Thread.Sleep(1);
}
}
void DisableWeight()
{
_mainProcessIsRun = false;
if (syncWegithThread != null && syncWegithThread.IsAlive)
syncWegithThread.Abort();
WeightValue = 0;
format = "{0:0.00}";
Thread.Sleep(10);
if (_inQueryThread.IsAlive)
{
_inQueryThread.Abort();
}
if (_outQueryThread.IsAlive)
{
_outQueryThread.Abort();
}
if (weightPort.IsOpen)
weightPort.Close();
}
public void enableWeight_Click(object sender, EventArgs e)
{
if (!enableWeight.Checked)
{
OpenSerialPort();
_mainProcessIsRun = true;
ReadData();
if (syncWegithThread != null && !syncWegithThread.IsAlive)
syncWegithThread.Start();
}
else
DisableWeight();
enableWeight.CheckState = enableWeight.Checked ? CheckState.Unchecked : CheckState.Checked;
}
decimal? WeightValue
{
get
{
if (!string.IsNullOrEmpty(lblChengZhong.Text))
return decimal.Parse(lblChengZhong.Text);
return null;
}
set { lblChengZhong.Text = string.Format(format, value); }
}
protected override void DefWndProc(ref Message m)
{
switch (m.Msg)
{
case WmUpdDisplayMessage:
lblChengZhong.Text = _displayValue;
break;
default:
base.DefWndProc(ref m);
break;
}
}
#endregion
}
}

+ 34
- 4
WeighAndGrading/GradeFrom.resx View File

@ -117,16 +117,46 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="H_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="H_Livestock_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="H_Index.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="H_Order.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="H_Technics.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="H_Livestock_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="H_Weight.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="H_Time.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="D_OrderDetail_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="D_Finish.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="D_Order.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="D_Technics_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="D_Number.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="D_Already.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

+ 229
- 0
WeighAndGrading/GradeSettingFrom.Designer.cs View File

@ -0,0 +1,229 @@
namespace WeighAndGrading
{
partial class GradeSettingFrom
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label5 = new System.Windows.Forms.Label();
this.closeBtn = new System.Windows.Forms.Button();
this.saveBtn = new System.Windows.Forms.Button();
this.bitSet = new System.Windows.Forms.ComboBox();
this.rateSet = new System.Windows.Forms.ComboBox();
this.comSet = new System.Windows.Forms.ComboBox();
this.weightSet = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.format = new BWP.WinFormControl.UTextBoxWithPad();
this.discont = new BWP.WinFormControl.UTextBoxWithPad();
this.SuspendLayout();
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("宋体", 15F);
this.label5.Location = new System.Drawing.Point(51, 230);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(109, 20);
this.label5.TabIndex = 20;
this.label5.Text = "显示格式:";
//
// closeBtn
//
this.closeBtn.Font = new System.Drawing.Font("宋体", 15F);
this.closeBtn.Location = new System.Drawing.Point(189, 326);
this.closeBtn.Name = "closeBtn";
this.closeBtn.Size = new System.Drawing.Size(75, 35);
this.closeBtn.TabIndex = 19;
this.closeBtn.Text = "关闭";
this.closeBtn.UseVisualStyleBackColor = true;
this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click);
//
// saveBtn
//
this.saveBtn.Font = new System.Drawing.Font("宋体", 15F);
this.saveBtn.Location = new System.Drawing.Point(83, 326);
this.saveBtn.Name = "saveBtn";
this.saveBtn.Size = new System.Drawing.Size(75, 35);
this.saveBtn.TabIndex = 18;
this.saveBtn.Text = "保存";
this.saveBtn.UseVisualStyleBackColor = true;
this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click);
//
// bitSet
//
this.bitSet.Font = new System.Drawing.Font("宋体", 15F);
this.bitSet.FormattingEnabled = true;
this.bitSet.Location = new System.Drawing.Point(173, 177);
this.bitSet.Name = "bitSet";
this.bitSet.Size = new System.Drawing.Size(121, 28);
this.bitSet.TabIndex = 15;
//
// rateSet
//
this.rateSet.Font = new System.Drawing.Font("宋体", 15F);
this.rateSet.FormattingEnabled = true;
this.rateSet.Location = new System.Drawing.Point(173, 125);
this.rateSet.Name = "rateSet";
this.rateSet.Size = new System.Drawing.Size(121, 28);
this.rateSet.TabIndex = 16;
//
// comSet
//
this.comSet.Font = new System.Drawing.Font("宋体", 15F);
this.comSet.FormattingEnabled = true;
this.comSet.Location = new System.Drawing.Point(173, 75);
this.comSet.Name = "comSet";
this.comSet.Size = new System.Drawing.Size(121, 28);
this.comSet.TabIndex = 17;
//
// weightSet
//
this.weightSet.Font = new System.Drawing.Font("宋体", 15F);
this.weightSet.FormattingEnabled = true;
this.weightSet.Location = new System.Drawing.Point(173, 27);
this.weightSet.Name = "weightSet";
this.weightSet.Size = new System.Drawing.Size(121, 28);
this.weightSet.TabIndex = 14;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("宋体", 15F);
this.label4.Location = new System.Drawing.Point(51, 180);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(89, 20);
this.label4.TabIndex = 13;
this.label4.Text = "数据位:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 15F);
this.label3.Location = new System.Drawing.Point(51, 128);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(89, 20);
this.label3.TabIndex = 12;
this.label3.Text = "波特率:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 15F);
this.label2.Location = new System.Drawing.Point(51, 78);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(89, 20);
this.label2.TabIndex = 11;
this.label2.Text = "端口号:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 15F);
this.label1.Location = new System.Drawing.Point(51, 30);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(89, 20);
this.label1.TabIndex = 10;
this.label1.Text = "称型号:";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("宋体", 15F);
this.label6.Location = new System.Drawing.Point(51, 281);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(69, 20);
this.label6.TabIndex = 22;
this.label6.Text = "扣重:";
//
// format
//
this.format.Font = new System.Drawing.Font("宋体", 14F);
this.format.Location = new System.Drawing.Point(173, 224);
this.format.Name = "format";
this.format.Size = new System.Drawing.Size(121, 29);
this.format.TabIndex = 23;
this.format.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Number;
//
// discont
//
this.discont.Font = new System.Drawing.Font("宋体", 14F);
this.discont.Location = new System.Drawing.Point(173, 272);
this.discont.Name = "discont";
this.discont.Size = new System.Drawing.Size(121, 29);
this.discont.TabIndex = 24;
this.discont.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Number;
//
// GradeSettingFrom
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(354, 381);
this.Controls.Add(this.discont);
this.Controls.Add(this.format);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.closeBtn);
this.Controls.Add(this.saveBtn);
this.Controls.Add(this.bitSet);
this.Controls.Add(this.rateSet);
this.Controls.Add(this.comSet);
this.Controls.Add(this.weightSet);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "GradeSettingFrom";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "称重设置";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button closeBtn;
private System.Windows.Forms.Button saveBtn;
private System.Windows.Forms.ComboBox bitSet;
private System.Windows.Forms.ComboBox rateSet;
private System.Windows.Forms.ComboBox comSet;
private System.Windows.Forms.ComboBox weightSet;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label6;
private BWP.WinFormControl.UTextBoxWithPad format;
private BWP.WinFormControl.UTextBoxWithPad discont;
}
}

+ 78
- 0
WeighAndGrading/GradeSettingFrom.cs View File

@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WeighAndGrading
{
public partial class GradeSettingFrom : Form
{
List<string> weight = new List<string> { "IND560", "Xk3124", "Xk3190A9", "Xk3190D10" };
List<string> com = new List<string> { "COM1", "COM2", "COM3", "COM4", "COM5" };
List<string> rate = new List<string> { "4800", "7200", "9600" };
List<string> bit = new List<string> { "5", "6", "7", "8" };
public GradeSettingFrom()
{
InitializeComponent();
weightSet.DataSource = weight;
comSet.DataSource = com;
rateSet.DataSource = rate;
bitSet.DataSource = bit;
if (!string.IsNullOrEmpty(GradeContext.Config.WeightSet))
weightSet.SelectedIndex = weight.IndexOf(GradeContext.Config.WeightSet);
else
weightSet.SelectedIndex = 0;
if (!string.IsNullOrEmpty(GradeContext.Config.ComSet))
comSet.SelectedIndex = com.IndexOf(GradeContext.Config.ComSet);
else
comSet.SelectedIndex = 0;
if (GradeContext.Config.RateSet.HasValue)
rateSet.SelectedIndex = rate.IndexOf(GradeContext.Config.RateSet.ToString());
else
rateSet.SelectedIndex = 2;
if (GradeContext.Config.BitSet.HasValue)
bitSet.SelectedIndex = bit.IndexOf(GradeContext.Config.BitSet.ToString());
else
bitSet.SelectedIndex = 3;
if (string.IsNullOrEmpty(GradeContext.Config.Format))
format.Text = "0.00";
else
format.Text = GradeContext.Config.Format;
if (GradeContext.Config.Discont == null)
discont.Text = "0.00";
else
discont.Text = GradeContext.Config.Discont.ToString();
}
private void saveBtn_Click(object sender, EventArgs e)
{
GradeContext.Config.WeightSet = weight[this.weightSet.SelectedIndex];
GradeContext.Config.ComSet = com[this.comSet.SelectedIndex];
GradeContext.Config.RateSet = int.Parse(rate[this.rateSet.SelectedIndex]);
GradeContext.Config.BitSet = int.Parse(bit[this.bitSet.SelectedIndex]);
GradeContext.Config.Format = format.Text;
if (!string.IsNullOrEmpty(discont.Text))
{
decimal v;
if (decimal.TryParse(discont.Text, out v))
GradeContext.Config.Discont = v;
else
throw new Exception("扣重格式输入不正确");
}
else
GradeContext.Config.Discont = 0;
GradeContext.Save();
MessageBox.Show("保存成功!");
}
private void closeBtn_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

+ 120
- 0
WeighAndGrading/GradeSettingFrom.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>

+ 93
- 0
WeighAndGrading/PrintAPI.cs View File

@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace WeighAndGrading
{
public static class PrintAPI
{
[DllImport("Winpplb.dll")]
private static extern int B_GetUSBBufferLen();
[DllImport("Winpplb.dll")]
private static extern int B_EnumUSB(byte[] buf);
[DllImport("Winpplb.dll")]
private static extern int B_CreateUSBPort(int nPort);
[DllImport("Winpplb.dll")]
private static extern int B_Set_Direction(char direction);
[DllImport("Winpplb.dll")]
private static extern int B_Prn_Text_TrueType(int x, int y, int FSize, string FType,
int Fspin, int FWeight, int FItalic, int FUnline, int FStrikeOut, string id_name,
string data);
[DllImport("Winpplb.dll")]
private static extern int B_Prn_Barcode(int x, int y, int ori, string type, int narrow,
int width, int height, char human, string data);
[DllImport("Winpplb.dll")]
private static extern int B_Bar2d_QR(int x, int y, int model, int scl, char error,
char dinput, int c, int d, int p, string data);
[DllImport("Winpplb.dll")]
private static extern int B_Print_Out(int labset);
[DllImport("Winpplb.dll")]
private static extern void B_ClosePrn();
public static void Print(PrintEntity entity)
{
B_GetUSBBufferLen();
B_EnumUSB(new byte[128]);
B_CreateUSBPort(1);
B_Prn_Text_TrueType(110, 31, 31, "宋体", 1, 700, 0, 0, 0, "C1", entity.AccountingUnit_Name);
B_Prn_Text_TrueType(42, 75, 31, "宋体", 1, 700, 0, 0, 0, "C2", "合格证");
B_Prn_Text_TrueType(440, 75, 31, "宋体", 1, 700, 0, 0, 0, "C3", entity.Goods_Name);
B_Prn_Text_TrueType(42, 125, 27, "宋体", 1, 400, 0, 0, 0, "C4", string.Format("生产日期:{0}", entity.Date.ToString("yyyy/MM/dd")));
B_Prn_Text_TrueType(42, 165, 27, "宋体", 1, 400, 0, 0, 0, "C5", string.Format("检 验 员:{0}", entity.Checker));
B_Prn_Text_TrueType(42, 205, 27, "宋体", 1, 400, 0, 0, 0, "C6", string.Format("保 质 期:{0}", entity.StoreCondition));
B_Prn_Text_TrueType(42, 255, 23, "宋体", 1, 400, 0, 0, 0, "C7", string.Format("产地:{0} 电话:{1}", entity.Place, entity.TelNumber));
B_Prn_Text_TrueType(42, 290, 23, "宋体", 1, 400, 0, 0, 0, "C8", string.Format("地址:{0}", entity.Address));
B_Prn_Barcode(42, 330, 0, "1", 3, 22, 35, 'N', entity.BarCode);
B_Prn_Text_TrueType(175, 370, 25, "宋体", 1, 500, 0, 0, 0, "C9", entity.BarCode);
B_Bar2d_QR(430, 120, 2, 7, 'M', 'A', 0, 0, 0, entity._2DQRCode);
B_Set_Direction('B');
B_Print_Out(1);
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; }
}
}

+ 19
- 0
WeighAndGrading/WeighAndGrading.csproj View File

@ -11,6 +11,7 @@
<AssemblyName>WeighAndGrading</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -20,6 +21,8 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -28,6 +31,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Forks.JsonRpc.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL" />
@ -46,20 +50,35 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="GradeContext.cs" />
<Compile Include="GradeFrom.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GradeFrom.Designer.cs">
<DependentUpon>GradeFrom.cs</DependentUpon>
</Compile>
<Compile Include="GradeSettingFrom.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GradeSettingFrom.Designer.cs">
<DependentUpon>GradeSettingFrom.cs</DependentUpon>
</Compile>
<Compile Include="PrintAPI.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="GradeFrom.resx">
<DependentUpon>GradeFrom.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GradeSettingFrom.resx">
<DependentUpon>GradeSettingFrom.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BO\BO.csproj">
<Project>{8968f14a-c7c7-4751-96ce-b114fbfd65ef}</Project>
<Name>BO</Name>
</ProjectReference>
<ProjectReference Include="..\BWP.WinFormControl\BWP.WinFormControl.csproj">
<Project>{A782B23E-BE6D-4F51-B5CB-5CD259BA97CC}</Project>
<Name>BWP.WinFormControl</Name>


Loading…
Cancel
Save