diff --git a/B3ButcherManageClient.sln b/B3ButcherManageClient.sln
index 10f1301..afdddf5 100644
--- a/B3ButcherManageClient.sln
+++ b/B3ButcherManageClient.sln
@@ -1,7 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
+# Visual Studio 2013
+VisualStudioVersion = 12.0.40629.0
+# Visual Studio 15
+VisualStudioVersion = 15.0.27004.2002
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BO", "BO\BO.csproj", "{8968F14A-C7C7-4751-96CE-B114FBFD65EF}"
EndProject
@@ -25,7 +27,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CreateUpdateXmlFile", "Crea
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrderConfirm", "OrderConfirm\OrderConfirm.csproj", "{D4723253-E102-40C7-819F-8052C5BE241D}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarcassStateWeight", "CarcassStateWeight\CarcassStateWeight.csproj", "{51C38871-00FE-4F18-BD49-D6A9124A844C}"
+
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrunksIousOutInStore", "TrunksIousOutInStore\TrunksIousOutInStore.csproj", "{4786A544-10F4-45C0-9E78-540914C2CE9D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -75,12 +78,19 @@ Global
{D4723253-E102-40C7-819F-8052C5BE241D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D4723253-E102-40C7-819F-8052C5BE241D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D4723253-E102-40C7-819F-8052C5BE241D}.Release|Any CPU.Build.0 = Release|Any CPU
- {51C38871-00FE-4F18-BD49-D6A9124A844C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {51C38871-00FE-4F18-BD49-D6A9124A844C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {51C38871-00FE-4F18-BD49-D6A9124A844C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {51C38871-00FE-4F18-BD49-D6A9124A844C}.Release|Any CPU.Build.0 = Release|Any CPU
+
+
+
+
+ {4786A544-10F4-45C0-9E78-540914C2CE9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4786A544-10F4-45C0-9E78-540914C2CE9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4786A544-10F4-45C0-9E78-540914C2CE9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4786A544-10F4-45C0-9E78-540914C2CE9D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {B1C1CB2D-8E4D-496F-8646-F31D1DC76EAC}
+ EndGlobalSection
EndGlobal
diff --git a/BO/BO.csproj b/BO/BO.csproj
index 59b91b8..23d3278 100644
--- a/BO/BO.csproj
+++ b/BO/BO.csproj
@@ -36,7 +36,7 @@
False
- D:\BwpB3Project\tsref\Debug\Forks.EnterpriseServices.dll
+ ..\..\..\tsref\Debug\Forks.EnterpriseServices.dll
False
@@ -44,7 +44,7 @@
False
- D:\BwpB3Project\tsref\Debug\Forks.Utils.dll
+ ..\..\..\tsref\Debug\Forks.Utils.dll
@@ -61,13 +61,15 @@
+
-
+
+
@@ -78,7 +80,6 @@
-
@@ -98,7 +99,7 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/WeighAndGrading/BodyDiscontSetting.cs b/WeighAndGrading/BodyDiscontSetting.cs
index 8ac75d1..27d4177 100644
--- a/WeighAndGrading/BodyDiscontSetting.cs
+++ b/WeighAndGrading/BodyDiscontSetting.cs
@@ -1,5 +1,6 @@
using BO;
using BO.BO.BaseInfo;
+using BO.Utils;
using BO.Utils.BillRpc;
using BWP.WinFormControl;
using System;
@@ -7,6 +8,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
+using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -17,10 +19,12 @@ namespace WeighAndGrading
public partial class BodyDiscontSetting : Form
{
List list;
+ string fileName;
public BodyDiscontSetting()
{
InitializeComponent();
- list = GradeAndWeightRpc.GetBodyDiscontItem().OrderBy(x => x.ID).ToList();
+ fileName = Path.Combine(GradeFrom.DATA_PATH, "Disconts.xml");
+ list = XmlUtil.DeserializeFromFile>(fileName);
uDataGridView1.DataSource = list;
uDataGridView1.Refresh();
}
@@ -34,7 +38,19 @@ namespace WeighAndGrading
var entity = row.DataBoundItem as BodyDiscontItem;
list.Add(new CTuple(entity.ID, entity.Discont));
}
- GradeAndWeightRpc.SaveBodyDiscontItem(list);
+ XmlUtil.SerializerObjToFile(list, fileName);
+ var changeFlagPath = Path.Combine(GradeFrom.DATA_PATH, "DiscontsChanged.txt");
+ bool existFile = File.Exists(changeFlagPath);
+
+ var connection = LoginRpcUtil.TestConnection();
+ if (connection)
+ {
+ GradeAndWeightRpc.SaveBodyDiscontItem(list);
+ if (existFile)
+ File.Delete(changeFlagPath);
+ }
+ else if (!existFile)
+ File.WriteAllText(changeFlagPath, string.Empty);
if (!changed)
changed = true;
MessageBox.Show("保存成功!");
@@ -42,7 +58,8 @@ namespace WeighAndGrading
private void closeBtn_Click(object sender, EventArgs e)
{
- DialogResult = DialogResult.OK;
+ if (changed)
+ DialogResult = DialogResult.OK;
this.Close();
}
diff --git a/WeighAndGrading/GradeContext.cs b/WeighAndGrading/GradeContext.cs
index 5702877..f5aec70 100644
--- a/WeighAndGrading/GradeContext.cs
+++ b/WeighAndGrading/GradeContext.cs
@@ -11,12 +11,7 @@ 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
{
diff --git a/WeighAndGrading/GradeFrom.Designer.cs b/WeighAndGrading/GradeFrom.Designer.cs
index a567758..6e0310a 100644
--- a/WeighAndGrading/GradeFrom.Designer.cs
+++ b/WeighAndGrading/GradeFrom.Designer.cs
@@ -30,13 +30,20 @@
{
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 dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = 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 dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = 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();
this.label1 = new System.Windows.Forms.Label();
this.syncBtn = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
@@ -44,11 +51,29 @@
this.label4 = new System.Windows.Forms.Label();
this.alreadyLabel = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.tangScrollBar = new System.Windows.Forms.VScrollBar();
this.ttPanel = new System.Windows.Forms.FlowLayoutPanel();
+ this.label10 = new System.Windows.Forms.Label();
+ this.tangGridView = new BWP.WinFormControl.UDataGridView();
+ this.T_OrderDetail_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.T_Finish = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.T_Order = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.T_Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.T_Already = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.T_FinishBtn = new System.Windows.Forms.DataGridViewButtonColumn();
this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.maoScrollBar = new System.Windows.Forms.VScrollBar();
+ this.maoGridView = new BWP.WinFormControl.UDataGridView();
+ this.M_OrderDetail_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.M_Finish = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.M_Order = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.M_Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.M_Already = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.M_FinishBtn = new System.Windows.Forms.DataGridViewButtonColumn();
this.label11 = new System.Windows.Forms.Label();
this.mbPanel = new System.Windows.Forms.FlowLayoutPanel();
this.groupBox3 = new System.Windows.Forms.GroupBox();
+ this.vScrollBar2 = new System.Windows.Forms.VScrollBar();
this.label12 = new System.Windows.Forms.Label();
this.historyGrid = new BWP.WinFormControl.UDataGridView();
this.H_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -59,7 +84,6 @@
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.vScrollBar2 = new System.Windows.Forms.VScrollBar();
this.enableWeight = new System.Windows.Forms.CheckBox();
this.isPrintCheckBox = new System.Windows.Forms.CheckBox();
this.printBtn = new System.Windows.Forms.Button();
@@ -84,13 +108,25 @@
this.discontBtn = new System.Windows.Forms.Button();
this.discontPanel = new System.Windows.Forms.FlowLayoutPanel();
this.vScrollBar1 = new System.Windows.Forms.VScrollBar();
+ this.statePic = new System.Windows.Forms.PictureBox();
+ this.H_SID = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.H_Livestock_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.H_ReadWeight = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+ this.H_Index = 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();
+ ((System.ComponentModel.ISupportInitialize)(this.tangGridView)).BeginInit();
this.groupBox2.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.maoGridView)).BeginInit();
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.historyGrid)).BeginInit();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.modifyPanel.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.statePic)).BeginInit();
this.SuspendLayout();
//
// label1
@@ -119,6 +155,7 @@
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 15F);
this.label2.Location = new System.Drawing.Point(511, 131);
+ this.label2.Location = new System.Drawing.Point(443, 136);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(109, 20);
this.label2.TabIndex = 5;
@@ -129,6 +166,7 @@
this.orderLabel.AutoSize = true;
this.orderLabel.Font = new System.Drawing.Font("宋体", 15F);
this.orderLabel.Location = new System.Drawing.Point(616, 131);
+ this.orderLabel.Location = new System.Drawing.Point(548, 136);
this.orderLabel.Name = "orderLabel";
this.orderLabel.Size = new System.Drawing.Size(19, 20);
this.orderLabel.TabIndex = 6;
@@ -139,6 +177,7 @@
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("宋体", 15F);
this.label4.Location = new System.Drawing.Point(675, 131);
+ this.label4.Location = new System.Drawing.Point(599, 136);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(109, 20);
this.label4.TabIndex = 7;
@@ -149,6 +188,7 @@
this.alreadyLabel.AutoSize = true;
this.alreadyLabel.Font = new System.Drawing.Font("宋体", 15F);
this.alreadyLabel.Location = new System.Drawing.Point(776, 131);
+ this.alreadyLabel.Location = new System.Drawing.Point(700, 136);
this.alreadyLabel.Name = "alreadyLabel";
this.alreadyLabel.Size = new System.Drawing.Size(19, 20);
this.alreadyLabel.TabIndex = 8;
@@ -156,32 +196,253 @@
//
// groupBox1
//
+ this.groupBox1.Controls.Add(this.tangScrollBar);
this.groupBox1.Controls.Add(this.ttPanel);
this.groupBox1.Location = new System.Drawing.Point(505, 175);
+ this.groupBox1.Controls.Add(this.label10);
+ this.groupBox1.Controls.Add(this.tangGridView);
+ this.groupBox1.Location = new System.Drawing.Point(16, 175);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(294, 330);
+ this.groupBox1.Size = new System.Drawing.Size(783, 330);
this.groupBox1.TabIndex = 9;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "烫褪";
//
+ // tangScrollBar
+ //
+ this.tangScrollBar.Location = new System.Drawing.Point(373, 36);
+ this.tangScrollBar.Name = "tangScrollBar";
+ this.tangScrollBar.Size = new System.Drawing.Size(40, 275);
+ this.tangScrollBar.TabIndex = 51;
+ //
// ttPanel
//
this.ttPanel.Location = new System.Drawing.Point(12, 36);
+ this.ttPanel.Location = new System.Drawing.Point(431, 35);
this.ttPanel.Name = "ttPanel";
this.ttPanel.Size = new System.Drawing.Size(270, 276);
+ this.ttPanel.Size = new System.Drawing.Size(337, 276);
this.ttPanel.TabIndex = 0;
//
+ // label10
+ //
+ this.label10.AutoSize = true;
+ this.label10.Font = new System.Drawing.Font("宋体", 15F);
+ this.label10.Location = new System.Drawing.Point(6, -1);
+ this.label10.Name = "label10";
+ this.label10.Size = new System.Drawing.Size(49, 20);
+ this.label10.TabIndex = 32;
+ this.label10.Text = "烫褪";
+ //
+ // tangGridView
+ //
+ this.tangGridView.AllowUserToAddRows = false;
+ this.tangGridView.AllowUserToDeleteRows = false;
+ this.tangGridView.AllowUserToResizeColumns = false;
+ this.tangGridView.AllowUserToResizeRows = false;
+ dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
+ this.tangGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
+ this.tangGridView.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.tangGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
+ this.tangGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.tangGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.T_OrderDetail_ID,
+ this.T_Finish,
+ this.T_Order,
+ this.T_Number,
+ this.T_Already,
+ this.T_FinishBtn});
+ this.tangGridView.Location = new System.Drawing.Point(10, 36);
+ this.tangGridView.MultiSelect = false;
+ this.tangGridView.Name = "tangGridView";
+ this.tangGridView.ReadOnly = true;
+ this.tangGridView.RowHeadersVisible = false;
+ dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ dataGridViewCellStyle4.ForeColor = System.Drawing.Color.Black;
+ dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
+ dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.Black;
+ this.tangGridView.RowsDefaultCellStyle = dataGridViewCellStyle4;
+ this.tangGridView.RowTemplate.Height = 60;
+ this.tangGridView.ScrollBars = System.Windows.Forms.ScrollBars.None;
+ this.tangGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+ this.tangGridView.Size = new System.Drawing.Size(363, 275);
+ this.tangGridView.TabIndex = 4;
+ this.tangGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.tangGridView_CellClick);
+ this.tangGridView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.tangGridView_CellContentClick);
+ //
+ // T_OrderDetail_ID
+ //
+ this.T_OrderDetail_ID.DataPropertyName = "OrderDetail_ID";
+ this.T_OrderDetail_ID.HeaderText = "OrderDetail_ID";
+ this.T_OrderDetail_ID.Name = "T_OrderDetail_ID";
+ this.T_OrderDetail_ID.ReadOnly = true;
+ this.T_OrderDetail_ID.Visible = false;
+ //
+ // T_Finish
+ //
+ this.T_Finish.DataPropertyName = "Finish";
+ this.T_Finish.HeaderText = "Finish";
+ this.T_Finish.Name = "T_Finish";
+ this.T_Finish.ReadOnly = true;
+ this.T_Finish.Visible = false;
+ //
+ // T_Order
+ //
+ this.T_Order.DataPropertyName = "Order";
+ this.T_Order.HeaderText = "屠宰顺序";
+ this.T_Order.Name = "T_Order";
+ this.T_Order.ReadOnly = true;
+ //
+ // T_Number
+ //
+ this.T_Number.DataPropertyName = "Number";
+ this.T_Number.HeaderText = "头数";
+ this.T_Number.Name = "T_Number";
+ this.T_Number.ReadOnly = true;
+ this.T_Number.Width = 80;
+ //
+ // T_Already
+ //
+ this.T_Already.DataPropertyName = "Already";
+ this.T_Already.HeaderText = "已宰";
+ this.T_Already.Name = "T_Already";
+ this.T_Already.ReadOnly = true;
+ this.T_Already.Width = 80;
+ //
+ // T_FinishBtn
+ //
+ dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle3.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10);
+ this.T_FinishBtn.DefaultCellStyle = dataGridViewCellStyle3;
+ this.T_FinishBtn.HeaderText = "完毕";
+ this.T_FinishBtn.Name = "T_FinishBtn";
+ this.T_FinishBtn.ReadOnly = true;
+ this.T_FinishBtn.Text = "完毕";
+ this.T_FinishBtn.UseColumnTextForButtonValue = true;
+ //
// groupBox2
//
+ this.groupBox2.Controls.Add(this.maoScrollBar);
+ this.groupBox2.Controls.Add(this.maoGridView);
this.groupBox2.Controls.Add(this.label11);
this.groupBox2.Controls.Add(this.mbPanel);
this.groupBox2.Location = new System.Drawing.Point(505, 525);
+ this.groupBox2.Location = new System.Drawing.Point(16, 525);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(294, 330);
+ this.groupBox2.Size = new System.Drawing.Size(783, 330);
this.groupBox2.TabIndex = 10;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "毛剥";
//
+ // maoScrollBar
+ //
+ this.maoScrollBar.Location = new System.Drawing.Point(373, 35);
+ this.maoScrollBar.Name = "maoScrollBar";
+ this.maoScrollBar.Size = new System.Drawing.Size(40, 278);
+ this.maoScrollBar.TabIndex = 52;
+ //
+ // maoGridView
+ //
+ this.maoGridView.AllowUserToAddRows = false;
+ this.maoGridView.AllowUserToDeleteRows = false;
+ this.maoGridView.AllowUserToResizeColumns = false;
+ this.maoGridView.AllowUserToResizeRows = false;
+ dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
+ this.maoGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle5;
+ this.maoGridView.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.maoGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle6;
+ this.maoGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.maoGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.M_OrderDetail_ID,
+ this.M_Finish,
+ this.M_Order,
+ this.M_Number,
+ this.M_Already,
+ this.M_FinishBtn});
+ this.maoGridView.Location = new System.Drawing.Point(10, 35);
+ this.maoGridView.MultiSelect = false;
+ this.maoGridView.Name = "maoGridView";
+ this.maoGridView.ReadOnly = true;
+ this.maoGridView.RowHeadersVisible = false;
+ dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ dataGridViewCellStyle8.ForeColor = System.Drawing.Color.Black;
+ dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
+ dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.Black;
+ this.maoGridView.RowsDefaultCellStyle = dataGridViewCellStyle8;
+ this.maoGridView.RowTemplate.Height = 60;
+ this.maoGridView.ScrollBars = System.Windows.Forms.ScrollBars.Horizontal;
+ this.maoGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+ this.maoGridView.Size = new System.Drawing.Size(363, 278);
+ this.maoGridView.TabIndex = 33;
+ this.maoGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.maoGridView_CellClick);
+ this.maoGridView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.maoGridView_CellContentClick);
+ //
+ // M_OrderDetail_ID
+ //
+ this.M_OrderDetail_ID.DataPropertyName = "OrderDetail_ID";
+ this.M_OrderDetail_ID.HeaderText = "OrderDetail_ID";
+ this.M_OrderDetail_ID.Name = "M_OrderDetail_ID";
+ this.M_OrderDetail_ID.ReadOnly = true;
+ this.M_OrderDetail_ID.Visible = false;
+ //
+ // M_Finish
+ //
+ this.M_Finish.DataPropertyName = "Finish";
+ this.M_Finish.HeaderText = "Finish";
+ this.M_Finish.Name = "M_Finish";
+ this.M_Finish.ReadOnly = true;
+ this.M_Finish.Visible = false;
+ //
+ // M_Order
+ //
+ this.M_Order.DataPropertyName = "Order";
+ this.M_Order.HeaderText = "屠宰顺序";
+ this.M_Order.Name = "M_Order";
+ this.M_Order.ReadOnly = true;
+ //
+ // 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 = 80;
+ //
+ // M_Already
+ //
+ this.M_Already.DataPropertyName = "Already";
+ this.M_Already.HeaderText = "已宰";
+ this.M_Already.Name = "M_Already";
+ this.M_Already.ReadOnly = true;
+ this.M_Already.Width = 80;
+ //
+ // M_FinishBtn
+ //
+ dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle7.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10);
+ this.M_FinishBtn.DefaultCellStyle = dataGridViewCellStyle7;
+ this.M_FinishBtn.HeaderText = "完毕";
+ this.M_FinishBtn.Name = "M_FinishBtn";
+ this.M_FinishBtn.ReadOnly = true;
+ this.M_FinishBtn.Text = "完毕";
+ this.M_FinishBtn.UseColumnTextForButtonValue = true;
+ //
// label11
//
this.label11.AutoSize = true;
@@ -195,12 +456,15 @@
// mbPanel
//
this.mbPanel.Location = new System.Drawing.Point(12, 37);
+ this.mbPanel.Location = new System.Drawing.Point(431, 35);
this.mbPanel.Name = "mbPanel";
this.mbPanel.Size = new System.Drawing.Size(270, 276);
+ this.mbPanel.Size = new System.Drawing.Size(337, 278);
this.mbPanel.TabIndex = 1;
//
// groupBox3
//
+ this.groupBox3.Controls.Add(this.vScrollBar2);
this.groupBox3.Controls.Add(this.label12);
this.groupBox3.Controls.Add(this.historyGrid);
this.groupBox3.Location = new System.Drawing.Point(826, 175);
@@ -210,6 +474,13 @@
this.groupBox3.TabStop = false;
this.groupBox3.Text = "记录";
//
+ // vScrollBar2
+ //
+ this.vScrollBar2.Location = new System.Drawing.Point(425, 36);
+ this.vScrollBar2.Name = "vScrollBar2";
+ this.vScrollBar2.Size = new System.Drawing.Size(40, 566);
+ this.vScrollBar2.TabIndex = 52;
+ //
// label12
//
this.label12.AutoSize = true;
@@ -228,6 +499,8 @@
this.historyGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.historyGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
+ dataGridViewCellStyle9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
+ this.historyGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9;
this.historyGrid.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
@@ -237,9 +510,18 @@
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.historyGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
+ dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+ dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control;
+ dataGridViewCellStyle10.Font = new System.Drawing.Font("宋体", 12F);
+ dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText;
+ dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+ dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+ dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.historyGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10;
this.historyGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.historyGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.H_ID,
+ this.H_SID,
this.H_Livestock_ID,
this.H_ReadWeight,
this.H_Index,
@@ -255,6 +537,9 @@
dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.historyGrid.RowsDefaultCellStyle = dataGridViewCellStyle5;
+ dataGridViewCellStyle13.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
+ this.historyGrid.RowsDefaultCellStyle = dataGridViewCellStyle13;
this.historyGrid.RowTemplate.Height = 40;
this.historyGrid.ScrollBars = System.Windows.Forms.ScrollBars.None;
this.historyGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
@@ -329,21 +614,17 @@
this.H_Time.Name = "H_Time";
this.H_Time.ReadOnly = true;
//
- // vScrollBar2
- //
- this.vScrollBar2.Location = new System.Drawing.Point(1248, 143);
- this.vScrollBar2.Name = "vScrollBar2";
- this.vScrollBar2.Size = new System.Drawing.Size(40, 566);
- this.vScrollBar2.TabIndex = 52;
- //
// 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);
+ this.enableWeight.Font = new System.Drawing.Font("宋体", 18F);
+ this.enableWeight.Location = new System.Drawing.Point(12, 91);
this.enableWeight.Name = "enableWeight";
this.enableWeight.Size = new System.Drawing.Size(108, 24);
+ this.enableWeight.Size = new System.Drawing.Size(125, 28);
this.enableWeight.TabIndex = 31;
this.enableWeight.Text = "启用称重";
this.enableWeight.UseVisualStyleBackColor = true;
@@ -564,6 +845,7 @@
this.modifyPanel.Controls.Add(this.cancelBtn);
this.modifyPanel.Controls.Add(this.stateLabel);
this.modifyPanel.Location = new System.Drawing.Point(813, 107);
+ this.modifyPanel.Location = new System.Drawing.Point(826, 107);
this.modifyPanel.Name = "modifyPanel";
this.modifyPanel.Size = new System.Drawing.Size(438, 56);
this.modifyPanel.TabIndex = 36;
@@ -600,19 +882,94 @@
this.discontPanel.TabIndex = 33;
//
// vScrollBar1
+ // statePic
//
this.vScrollBar1.Location = new System.Drawing.Point(455, 175);
this.vScrollBar1.Name = "vScrollBar1";
this.vScrollBar1.Size = new System.Drawing.Size(40, 566);
this.vScrollBar1.TabIndex = 51;
+ this.statePic.ErrorImage = null;
+ this.statePic.InitialImage = null;
+ this.statePic.Location = new System.Drawing.Point(219, 89);
+ this.statePic.Name = "statePic";
+ this.statePic.Size = new System.Drawing.Size(30, 30);
+ this.statePic.TabIndex = 38;
+ this.statePic.TabStop = false;
+ //
+ // H_SID
+ //
+ this.H_SID.DataPropertyName = "SID";
+ this.H_SID.HeaderText = "SID";
+ this.H_SID.Name = "H_SID";
+ this.H_SID.ReadOnly = true;
+ this.H_SID.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_ReadWeight
+ //
+ this.H_ReadWeight.DataPropertyName = "ReadWeight";
+ this.H_ReadWeight.HeaderText = "";
+ this.H_ReadWeight.Name = "H_ReadWeight";
+ this.H_ReadWeight.ReadOnly = true;
+ this.H_ReadWeight.Width = 30;
+ //
+ // 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_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";
+ dataGridViewCellStyle11.Format = "#0.######";
+ this.H_Weight.DefaultCellStyle = dataGridViewCellStyle11;
+ this.H_Weight.HeaderText = "重量";
+ this.H_Weight.Name = "H_Weight";
+ this.H_Weight.ReadOnly = true;
+ this.H_Weight.Width = 70;
+ //
+ // H_Time
+ //
+ this.H_Time.DataPropertyName = "Time";
+ dataGridViewCellStyle12.Format = "MM/dd HH:mm";
+ dataGridViewCellStyle12.NullValue = null;
+ this.H_Time.DefaultCellStyle = dataGridViewCellStyle12;
+ 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(1362, 741);
- this.Controls.Add(this.vScrollBar2);
+ this.ClientSize = new System.Drawing.Size(1379, 865);
this.Controls.Add(this.vScrollBar1);
+ this.Controls.Add(this.statePic);
this.Controls.Add(this.discontPanel);
this.Controls.Add(this.discontBtn);
this.Controls.Add(this.modifyPanel);
@@ -639,9 +996,13 @@
this.Name = "GradeFrom";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "称重定级";
+ this.Load += new System.EventHandler(this.GradeFrom_Load);
this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.tangGridView)).EndInit();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.maoGridView)).EndInit();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.historyGrid)).EndInit();
@@ -650,6 +1011,7 @@
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.modifyPanel.ResumeLayout(false);
this.modifyPanel.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.statePic)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -661,6 +1023,7 @@
private BWP.WinFormControl.UDatePicker butcherTimeInput;
private System.Windows.Forms.Button syncBtn;
private BWP.WinFormControl.UDataGridView dataGridView;
+ private BWP.WinFormControl.UDataGridView tangGridView;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label orderLabel;
private System.Windows.Forms.Label label4;
@@ -688,6 +1051,23 @@
private System.Windows.Forms.FlowLayoutPanel discontPanel;
private System.Windows.Forms.VScrollBar vScrollBar2;
private System.Windows.Forms.DataGridViewTextBoxColumn H_ID;
+ private System.Windows.Forms.VScrollBar tangScrollBar;
+ private System.Windows.Forms.VScrollBar maoScrollBar;
+ private BWP.WinFormControl.UDataGridView maoGridView;
+ private System.Windows.Forms.DataGridViewTextBoxColumn T_OrderDetail_ID;
+ private System.Windows.Forms.DataGridViewTextBoxColumn T_Finish;
+ private System.Windows.Forms.DataGridViewTextBoxColumn T_Order;
+ private System.Windows.Forms.DataGridViewTextBoxColumn T_Number;
+ private System.Windows.Forms.DataGridViewTextBoxColumn T_Already;
+ private System.Windows.Forms.DataGridViewButtonColumn T_FinishBtn;
+ private System.Windows.Forms.DataGridViewTextBoxColumn M_OrderDetail_ID;
+ private System.Windows.Forms.DataGridViewTextBoxColumn M_Finish;
+ private System.Windows.Forms.DataGridViewTextBoxColumn M_Order;
+ private System.Windows.Forms.DataGridViewTextBoxColumn M_Number;
+ private System.Windows.Forms.DataGridViewTextBoxColumn M_Already;
+ private System.Windows.Forms.DataGridViewButtonColumn M_FinishBtn;
+ private System.Windows.Forms.PictureBox statePic;
+ private System.Windows.Forms.DataGridViewTextBoxColumn H_SID;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_ID;
private System.Windows.Forms.DataGridViewCheckBoxColumn H_ReadWeight;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Index;
diff --git a/WeighAndGrading/GradeFrom.cs b/WeighAndGrading/GradeFrom.cs
index 6ef7901..2b80e4e 100644
--- a/WeighAndGrading/GradeFrom.cs
+++ b/WeighAndGrading/GradeFrom.cs
@@ -1,4 +1,5 @@
using BO;
+using BO.BO.BaseInfo;
using BO.BO.Bill;
using BO.Utils;
using BO.Utils.BillRpc;
@@ -10,8 +11,10 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
+using System.IO;
using System.IO.Ports;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -29,19 +32,34 @@ namespace WeighAndGrading
public Form Generate()
{
+ if (string.IsNullOrEmpty(ButcherAppContext.Context.UrlConfig.OfflineSqlConnection))
+ throw new Exception("请先设置离线数据库并保存");
+ if (!LocalGradeAndWeightBL.ConnectionTest())
+ throw new Exception("离线数据库连接失败");
return this;
}
#endregion
private delegate void InvokeHandler();
- List list;
+ public const string DATA_PATH = "G_A_W_Data";
+ const short TANG_TECH = 0;
+ const short MAO_TECH = 1;
+ List tangList;
+ List maoList;
List details;
+
+ List localTang, localMao;
+ string maoFilePath, tangFilePath;
+ string discontPath = Path.Combine(DATA_PATH, "Disconts.xml");
+
+ bool connection = false;
+
SerialPort weightPort;
int maxIndex = 0;
- ConcurrentQueue noLivestockList = new ConcurrentQueue();
+ ConcurrentQueue noLivestockList;
- ConcurrentQueue noWeightList = new ConcurrentQueue();
+ ConcurrentQueue noWeightList;
Thread syncWork;
-
+ Thread syncToServer;
#region weightNeed
private IDataFormat _dataFormat;
private Thread _inQueryThread;
@@ -53,11 +71,18 @@ namespace WeighAndGrading
{
InitializeComponent();
butcherTimeInput.Date = DateTime.Today;
- dataGridView.AutoGenerateColumns = false;
- dataGridView.DataSource = null;
+ tangGridView.AutoGenerateColumns = false;
+ tangGridView.DataSource = null;
+ maoGridView.AutoGenerateColumns = false;
+ maoGridView.DataSource = null;
historyGrid.AutoGenerateColumns = false;
+ if (!Directory.Exists(DATA_PATH))
+ Directory.CreateDirectory(DATA_PATH);
+ maoFilePath = Path.Combine(DATA_PATH, "MaoList.xml");
+ tangFilePath = Path.Combine(DATA_PATH, "TangList.xml");
+ connection = ButcherAppContext.Context.UserConfig.Connection;
AddLivestockBtn();
- BuildDiscontPanel();
+ BuildDiscontPanel(true);
weightPort = new SerialPort();
this.FormClosing += delegate
{
@@ -65,6 +90,8 @@ namespace WeighAndGrading
DisableWeight();
if (syncWork != null && syncWork.IsAlive)
syncWork.Abort();
+ if (syncToServer != null && syncToServer.IsAlive)
+ syncToServer.Abort();
};
}
@@ -72,10 +99,18 @@ namespace WeighAndGrading
void AddLivestockBtn()
{
- var livestocks = BaseInfoRpcUtil.GetLivestockList();
+ var livestocks = new List>();
+ var fileName = Path.Combine(DATA_PATH, "Livestocks.xml");
+ if (connection)
+ {
+ livestocks = BaseInfoRpcUtil.GetLivestockList();
+ XmlUtil.SerializerObjToFile(livestocks, fileName);
+ }
+ else
+ livestocks = XmlUtil.DeserializeFromFile>>(fileName);
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) };
+ var btn = new Button() { Name = "_" + item.Item1, Text = item.Item2, Tag = item, Size = new Size(90, 75), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 15 }, Font = new Font("宋体", 18) };
btn.Click += (sender, e) =>
{
if (details == null)
@@ -91,8 +126,8 @@ namespace WeighAndGrading
modifyDetail.Livestock_ID = livestockTag.Item1;
modifyDetail.Livestock_Name = livestockTag.Item2;
modifyDetail.Technics = livestockTag.Item3;
- modifyDetail.Technics_Name = livestockTag.Item3 == 0 ? "烫褪" : "毛剥";
- GradeAndWeightRpc.UpdateLivestock(modifyDetail.ID, modifyDetail.Livestock_ID, modifyDetail.Livestock_Name, modifyDetail.Technics, modifyDetail.Technics_Name);
+ modifyDetail.Technics_Name = livestockTag.Item3 == TANG_TECH ? "烫褪" : "毛剥";
+ LocalGradeAndWeightBL.Update(modifyDetail, "Livestock_ID", "Livestock_Name", "Technics", "Technics_Name");
historyGrid.Refresh();
modifyDetail = null;
modifyPanel.Hide();
@@ -101,11 +136,27 @@ namespace WeighAndGrading
//var name = livestock.Technics == 0 ? "带皮白条" : "去皮白条";
//Print(name, entity.Index);
};
- if (item.Item3 == 0)
+ if (item.Item3 == TANG_TECH)
ttPanel.Controls.Add(btn);
else
mbPanel.Controls.Add(btn);
}
+ SetMargin(ttPanel);
+ SetMargin(mbPanel);
+ }
+
+ void SetMargin(FlowLayoutPanel panel)
+ {
+ for (var i = 0; i < panel.Controls.Count; i++)
+ {
+ var c = panel.Controls[i];
+ if (i % 3 == 0)//left
+ c.Margin = new Padding(0, c.Margin.Top, c.Margin.Right, c.Margin.Bottom);
+ if ((i + 1) % 3 == 0)//right
+ c.Margin = new Padding(c.Margin.Left, c.Margin.Top, 0, c.Margin.Bottom);
+ if (i <= 2)//firstRow
+ c.Margin = new Padding(c.Margin.Left, 0, c.Margin.Right, c.Margin.Bottom);
+ }
}
private void closeBtn_Click(object sender, EventArgs e)
@@ -115,12 +166,7 @@ namespace WeighAndGrading
private void syncBtn_Click(object sender, EventArgs e)
{
- list = GradeAndWeightRpc.GetGradeAndWeightList(butcherTimeInput.Date.Value);
- BindDataGrid();
- tangRow = FindRowSetSelected(tangEntity);
- maoRow = FindRowSetSelected(maoEntity);
- dataGridView.Refresh();
- details = GradeAndWeightRpc.GetDetails(butcherTimeInput.Date.Value, 50);
+ details = LocalGradeAndWeightBL.GetDetails(butcherTimeInput.Date.Value, 50);
FillQueue();
BindDetailGrid();
if (details.Any())
@@ -144,15 +190,12 @@ namespace WeighAndGrading
{
while (true)
{
- Thread.Sleep(5000);
this.Invoke(new InvokeHandler(delegate()
{
- list = GradeAndWeightRpc.GetGradeAndWeightList(butcherTimeInput.Date.Value);
- BindDataGrid();
- tangRow = FindRowSetSelected(tangEntity);
- maoRow = FindRowSetSelected(maoEntity);
- dataGridView.Refresh();
+ BindTangGrid();
+ BindMaoGrid();
}));
+ Thread.Sleep(5000);
}
}
@@ -178,25 +221,104 @@ namespace WeighAndGrading
}
}
- void BindDataGrid()
+ void BindTangGrid()
+ {
+ VerifyConnection();
+ if (connection)
+ {
+ try
+ {
+ tangList = GradeAndWeightRpc.GetGradeAndWeightList(butcherTimeInput.Date.Value, true);
+ }
+ catch (TimeoutException) { }
+ }
+ else
+ {
+ if (tangList == null)
+ tangList = new List();
+ }
+ tangGridView.DataSource = tangList.OrderBy(x => x.Order).OrderBy(x => x.Finish).ToList();
+ if (tangEntity == null && tangGridView.CurrentRow != null)
+ {
+ tangEntity = tangGridView.CurrentRow.DataBoundItem as GradeAndWeight;
+ if (tangEntity.Finish)
+ tangEntity = null;
+ }
+ foreach (DataGridViewRow row in tangGridView.Rows)
+ {
+ if ((bool)row.Cells["T_Finish"].Value)
+ row.DefaultCellStyle.BackColor = Color.YellowGreen;
+ if (tangEntity != null && tangEntity.OrderDetail_ID == (long)row.Cells["T_OrderDetail_ID"].Value)
+ {
+ tangEntity = row.DataBoundItem as GradeAndWeight;
+ if (tangEntity.Finish)
+ row.DefaultCellStyle.BackColor = Color.Yellow;
+ else
+ row.DefaultCellStyle.BackColor = tangGridView.RowsDefaultCellStyle.SelectionBackColor;
+ }
+ }
+ InitTangScrollBar();
+ tangGridView.ClearSelection();
+ try
+ {
+ if (tangRoll != -1)
+ tangGridView.FirstDisplayedScrollingRowIndex = tangRoll;
+ }
+ catch
+ {
+ tangRoll = -1;
+ }
+ tangGridView.Refresh();
+ }
+
+ void BindMaoGrid()
{
- dataGridView.DataSource = list.OrderBy(x => x.Order).OrderBy(x => x.Finish).ToList();
- foreach (DataGridViewRow row in dataGridView.Rows)
+ VerifyConnection();
+ if (connection)
+ {
+ try
+ {
+ maoList = GradeAndWeightRpc.GetGradeAndWeightList(butcherTimeInput.Date.Value, false);
+ }
+ catch (TimeoutException) { }
+ }
+ else
{
- if ((bool)row.Cells["D_Finish"].Value)
+ if (maoList == null)
+ maoList = new List();
+ }
+ maoGridView.DataSource = maoList.OrderBy(x => x.Order).OrderBy(x => x.Finish).ToList();
+ if (maoEntity == null && maoGridView.CurrentRow != null)
+ {
+ maoEntity = maoGridView.CurrentRow.DataBoundItem as GradeAndWeight;
+ if (maoEntity.Finish)
+ maoEntity = null;
+ }
+ foreach (DataGridViewRow row in maoGridView.Rows)
+ {
+ if ((bool)row.Cells["M_Finish"].Value)
row.DefaultCellStyle.BackColor = Color.YellowGreen;
+ if (maoEntity != null && maoEntity.OrderDetail_ID == (long)row.Cells["M_OrderDetail_ID"].Value)
+ {
+ maoEntity = row.DataBoundItem as GradeAndWeight;
+ if (maoEntity.Finish)
+ row.DefaultCellStyle.BackColor = Color.Yellow;
+ else
+ row.DefaultCellStyle.BackColor = maoGridView.RowsDefaultCellStyle.SelectionBackColor;
+ }
}
- InitScrollBar1();
- dataGridView.ClearSelection();
+ InitMaoScrollBar();
+ maoGridView.ClearSelection();
try
{
- if (leftRoll != -1)
- dataGridView.FirstDisplayedScrollingRowIndex = leftRoll;
+ if (maoRoll != -1)
+ maoGridView.FirstDisplayedScrollingRowIndex = maoRoll;
}
catch
{
- leftRoll = -1;
+ maoRoll = -1;
}
+ maoGridView.Refresh();
}
void BindDetailGrid()
@@ -209,7 +331,7 @@ namespace WeighAndGrading
{
foreach (DataGridViewRow row in historyGrid.Rows)
{
- if ((long)row.Cells["H_ID"].Value == lastSelectID)
+ if ((long)row.Cells["H_SID"].Value == lastSelectID)
{
historyGrid.CurrentCell = row.Cells[row.Cells.Count - 1];
break;
@@ -465,10 +587,10 @@ namespace WeighAndGrading
lock (_obj)
{
var currentRow = livestock.Item3 == 0 ? tangEntity : maoEntity;
- var tech = livestock.Item3 == 0 ? "烫褪" : "毛剥";
+ var tech = livestock.Item3 == TANG_TECH ? "烫褪" : "毛剥";
GradeAndWeight_Detail first;
- if (noLivestockList.TryPeek(out first) && first.Livestock_ID == 0)
+ if (noLivestockList.TryPeek(out first) && first.Livestock_ID == null)
{
noLivestockList.TryDequeue(out first);
if (currentRow != null)
@@ -478,7 +600,13 @@ namespace WeighAndGrading
first.Livestock_Name = livestock.Item2;
first.Technics = livestock.Item3;
first.Technics_Name = tech;
- GradeAndWeightRpc.UpdateOrInsertDetail(first, true);
+ if (disBtn != null)
+ {
+ first.Weight = (first.Weight ?? 0) - Convert.ToDecimal(disBtn.Tag);
+ SetBtnUnCheck(disBtn);
+ disBtn = null;
+ }
+ LocalGradeAndWeightBL.Update(first, "OrderDetail_ID", "Date", "Livestock_ID", "Livestock_Name", "Technics", "Technics_Name", "Weight");
historyGrid.Refresh();
}
else//add
@@ -495,10 +623,16 @@ namespace WeighAndGrading
entity.Technics_Name = tech;
entity.Time = DateTime.Now;
entity.Date = butcherTimeInput.Date.Value;
+ if (disBtn != null)
+ {
+ entity.Weight = -Convert.ToDecimal(disBtn.Tag);
+ SetBtnUnCheck(disBtn);
+ disBtn = null;
+ }
if (details.Count == 50)
details.RemoveAt(49);
details.Insert(0, entity);
- GradeAndWeightRpc.UpdateOrInsertDetail(entity, true);
+ LocalGradeAndWeightBL.Insert(entity);
noWeightList.Enqueue(entity);
BindDetailGrid();
}
@@ -507,7 +641,7 @@ namespace WeighAndGrading
currentRow.Already = currentRow.Already + 1;
orderLabel.Text = currentRow.Order.ToString();
alreadyLabel.Text = currentRow.Already.ToString();
- dataGridView.Refresh();
+ tangGridView.Refresh();
}
else
{
@@ -530,7 +664,7 @@ namespace WeighAndGrading
first.Weight = (first.Weight ?? 0) + weight;
else
first.Weight = weight;
- GradeAndWeightRpc.UpdateOrInsertDetail(first);
+ LocalGradeAndWeightBL.Update(first, "Weight");
historyGrid.Refresh();
}
else//add
@@ -544,7 +678,7 @@ namespace WeighAndGrading
if (details.Count == 50)
details.RemoveAt(49);
details.Insert(0, entity);
- GradeAndWeightRpc.UpdateOrInsertDetail(entity);
+ LocalGradeAndWeightBL.Insert(entity);
noLivestockList.Enqueue(entity);
BindDetailGrid();
}
@@ -564,10 +698,10 @@ namespace WeighAndGrading
if (e.RowIndex < 0)
return;
var currentRow = historyGrid.CurrentRow.DataBoundItem as GradeAndWeight_Detail;
- lastSelectID = currentRow.ID;
+ lastSelectID = currentRow.SID;
if (e.ColumnIndex == 2)
{
- if (lastCheckItem != null && lastCheckItem.ID != currentRow.ID)
+ if (lastCheckItem != null && lastCheckItem.SID != currentRow.SID)
lastCheckItem.ReadWeight = false;
lastCheckItem = currentRow;
lastCheckItem.ReadWeight = !lastCheckItem.ReadWeight;
@@ -583,7 +717,7 @@ namespace WeighAndGrading
foreach (var item in details)
{
stack.Push(item);
- if (item.ID == lastCheckItem.ID)
+ if (item.SID == lastCheckItem.SID)
break;
}
while (stack.Count > 0)
@@ -601,122 +735,202 @@ namespace WeighAndGrading
modifyPanel.Show();
}
- DataGridViewRow tangRow;
- DataGridViewRow maoRow;
- private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
+ private void tangGridView_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1)
return;
- var entity = dataGridView.CurrentRow.DataBoundItem as GradeAndWeight;
- if (entity.Technics_Name == "烫褪")
+ if (e.ColumnIndex == tangGridView.Columns.Count - 1)
+ return;
+ var entity = tangGridView.CurrentRow.DataBoundItem as GradeAndWeight;
+ if (tangEntity != null)
{
- if (tangRow != null)
+ foreach (DataGridViewRow row in tangGridView.Rows)
{
- if (tangEntity.Finish)
- tangRow.DefaultCellStyle.BackColor = Color.YellowGreen;
- else
- tangRow.DefaultCellStyle.BackColor = dataGridView.RowsDefaultCellStyle.BackColor;
+ if (tangEntity.OrderDetail_ID == (long)row.Cells["T_OrderDetail_ID"].Value)
+ {
+ row.DefaultCellStyle.BackColor = tangEntity.Finish ? Color.YellowGreen : tangGridView.RowsDefaultCellStyle.BackColor;
+ break;
+ }
}
- tangRow = dataGridView.CurrentRow;
- tangRow.DefaultCellStyle.BackColor = tangRow.DefaultCellStyle.SelectionBackColor = entity.Finish ? Color.YellowGreen : dataGridView.RowsDefaultCellStyle.SelectionBackColor;
- tangEntity = entity;
}
+ tangEntity = entity;
+ tangGridView.CurrentRow.DefaultCellStyle.SelectionBackColor = tangEntity.Finish ? Color.Yellow : tangGridView.RowsDefaultCellStyle.SelectionBackColor;
+ tangGridView.Refresh();
+ }
+
+ private void tangGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
+ {
+ if (e.RowIndex == -1)
+ return;
+ if (e.ColumnIndex != tangGridView.ColumnCount - 1)
+ return;
+ var entity = tangGridView.CurrentRow.DataBoundItem as GradeAndWeight;
+ if (entity.Finish)
+ return;
+ entity.Finish = true;
+ VerifyConnection();
+ if (connection)
+ GradeAndWeightRpc.SetGradeFinish(entity.OrderDetail_ID, TANG_TECH);
else
{
- if (maoRow != null)
+ localTang = XmlUtil.DeserializeFromFile>(tangFilePath);
+ if (!localTang.Contains(entity.OrderDetail_ID))
{
- if (maoEntity.Finish)
- maoRow.DefaultCellStyle.BackColor = Color.YellowGreen;
- else
- maoRow.DefaultCellStyle.BackColor = dataGridView.RowsDefaultCellStyle.BackColor;
+ localTang.Add(entity.OrderDetail_ID);
+ SaveEntityToLocal(true);
}
- maoRow = dataGridView.CurrentRow;
- maoRow.DefaultCellStyle.BackColor = maoRow.DefaultCellStyle.SelectionBackColor = entity.Finish ? Color.YellowGreen : Color.Yellow;
- maoEntity = entity;
+ var f = tangList.FirstOrDefault(x => x.OrderDetail_ID == entity.OrderDetail_ID);
+ if (f != null)
+ f.Finish = true;
}
+ BindTangGrid();
+ }
- if (e.ColumnIndex == dataGridView.ColumnCount - 1 && !entity.Finish)
+ private void maoGridView_CellClick(object sender, DataGridViewCellEventArgs e)
+ {
+ if (e.RowIndex == -1)
+ return;
+ if (e.ColumnIndex == maoGridView.Columns.Count - 1)
+ return;
+ var entity = maoGridView.CurrentRow.DataBoundItem as GradeAndWeight;
+ if (maoEntity != null)
{
- entity.Finish = true;
- GradeAndWeightRpc.SetGradeFinish(entity.OrderDetail_ID, entity.Technics);
- BindDataGrid();
- if (entity.Technics == 0)
- {
- maoRow = FindRowSetSelected(maoEntity);
- tangEntity = null;
- tangRow = null;
- }
- else
+ foreach (DataGridViewRow row in maoGridView.Rows)
{
- tangRow = FindRowSetSelected(tangEntity);
- maoEntity = null;
- maoRow = null;
+ if (maoEntity.OrderDetail_ID == (long)row.Cells["M_OrderDetail_ID"].Value)
+ {
+ row.DefaultCellStyle.BackColor = maoEntity.Finish ? Color.YellowGreen : maoGridView.RowsDefaultCellStyle.BackColor;
+ break;
+ }
}
}
- dataGridView.Refresh();
+ maoEntity = entity;
+ maoGridView.CurrentRow.DefaultCellStyle.SelectionBackColor = maoEntity.Finish ? Color.Yellow : maoGridView.RowsDefaultCellStyle.SelectionBackColor;
+ maoGridView.Refresh();
}
- DataGridViewRow FindRowSetSelected(GradeAndWeight tag)
+ private void maoGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
- if (tag == null)
- return null;
- foreach (DataGridViewRow row in dataGridView.Rows)
+ if (e.RowIndex == -1)
+ return;
+ if (e.ColumnIndex != maoGridView.ColumnCount - 1)
+ return;
+ var entity = maoGridView.CurrentRow.DataBoundItem as GradeAndWeight;
+ if (entity.Finish)
+ return;
+ entity.Finish = true;
+ VerifyConnection();
+ if (connection)
+ GradeAndWeightRpc.SetGradeFinish(entity.OrderDetail_ID, MAO_TECH);
+ else
{
- if ((long)row.Cells["D_OrderDetail_ID"].Value == tag.OrderDetail_ID && (string)row.Cells["D_Technics_Name"].Value == tag.Technics_Name)
+ localMao = XmlUtil.DeserializeFromFile>(maoFilePath);
+ if (!localMao.Contains(entity.OrderDetail_ID))
{
- if (tag.Finish)
- row.DefaultCellStyle.BackColor = Color.YellowGreen;
- else
- row.DefaultCellStyle.BackColor = tag.Technics == 1 ? Color.Yellow : dataGridView.RowsDefaultCellStyle.SelectionBackColor;
-
- if (tag.Technics == 0)
- tangEntity = row.DataBoundItem as GradeAndWeight;
- else
- maoEntity = row.DataBoundItem as GradeAndWeight;
- return row;
+ localMao.Add(entity.OrderDetail_ID);
+ SaveEntityToLocal(false);
}
+ var f = maoList.FirstOrDefault(x => x.OrderDetail_ID == entity.OrderDetail_ID);
+ if (f != null)
+ f.Finish = true;
}
- return null;
+
+ BindMaoGrid();
}
private void discontBtn_Click(object sender, EventArgs e)
{
if (new BodyDiscontSetting().ShowDialog() == DialogResult.OK)
- BuildDiscontPanel();
+ BuildDiscontPanel(false);
}
- void BuildDiscontPanel()
+ Button disBtn = null;
+ void BuildDiscontPanel(bool firstLoad)
{
- var disconts = GradeAndWeightRpc.GetBodyDiscontItem().Where(x => x.Discont > 0).OrderBy(x => x.ID);
+ var disconts = new List();
+ if (!firstLoad)
+ VerifyConnection();
+ if (connection)
+ {
+ disconts = GradeAndWeightRpc.GetBodyDiscontItem();
+ XmlUtil.SerializerObjToFile(disconts, discontPath);
+ }
+ else
+ disconts = XmlUtil.DeserializeFromFile>(discontPath);
+
+ disconts = disconts.Where(x => x.Discont > 0).OrderBy(x => x.ID).ToList();
discontPanel.Controls.Clear();
foreach (var item in disconts)
{
- var btn = new Button() { Name = "_D" + item.ID, Text = item.Name, Tag = item.Discont, Size = new Size(70, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { Left = 0, Right = 0, Top = 10, Bottom = 10 }, Font = new Font("宋体", 15) };
+ var btn = new Button() { Name = "_D" + item.ID, Text = item.Name, Tag = item.Discont, Size = new Size(70, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { Bottom = 30 }, Font = new Font("宋体", 15) };
btn.Click += (sender, e) =>
{
if (modifyDetail == null)
- throw new Exception("请先选择要扣重的记录");
- modifyDetail.Weight = (modifyDetail.Weight ?? 0) - Convert.ToDecimal(btn.Tag);
- GradeAndWeightRpc.UpdateWeight(modifyDetail.ID, modifyDetail.Weight);
- historyGrid.Refresh();
- modifyDetail = null;
- modifyPanel.Hide();
+ {
+ if (disBtn != null)
+ SetBtnUnCheck(disBtn);
+ if (disBtn != btn)
+ {
+ disBtn = btn;
+ SetBtnChecked(disBtn);
+ }
+ else
+ disBtn = null;
+ }
+ else
+ {
+ modifyDetail.Weight = (modifyDetail.Weight ?? 0) - Convert.ToDecimal(btn.Tag);
+ LocalGradeAndWeightBL.Update(modifyDetail, "Weight");
+ historyGrid.Refresh();
+ modifyDetail = null;
+ modifyPanel.Hide();
+ }
};
discontPanel.Controls.Add(btn);
}
}
- int leftRoll = -1;
- private void InitScrollBar1()
+ readonly Color btnSelectForeColor = Color.FromArgb(255, 255, 255);
+ readonly Color btnSelectBackColor = Color.FromArgb(66, 163, 218);
+ Color btnUnSelectForeColor = SystemColors.ControlText;
+ Color btnUnSelectBackColor = Color.FromArgb(225, 225, 225);
+ void SetBtnChecked(Button btn)
+ {
+ btn.BackColor = btnSelectBackColor;
+ btn.ForeColor = btnSelectForeColor;
+ }
+
+ void SetBtnUnCheck(Button btn)
{
- vScrollBar1.Maximum = (dataGridView.RowCount - dataGridView.DisplayedRowCount(false) + 30) * dataGridView.RowTemplate.Height;
- vScrollBar1.Minimum = 0;
- vScrollBar1.SmallChange = dataGridView.RowTemplate.Height;
- vScrollBar1.LargeChange = dataGridView.RowTemplate.Height * 30;
- this.vScrollBar1.Scroll += (sender, e) =>
+ btn.BackColor = btnUnSelectBackColor;
+ btn.ForeColor = btnUnSelectForeColor;
+ }
+
+ int tangRoll = -1;
+ private void InitTangScrollBar()
+ {
+ tangScrollBar.Maximum = (tangGridView.RowCount - tangGridView.DisplayedRowCount(false) + 30) * tangGridView.RowTemplate.Height;
+ tangScrollBar.Minimum = 0;
+ tangScrollBar.SmallChange = tangGridView.RowTemplate.Height;
+ tangScrollBar.LargeChange = tangGridView.RowTemplate.Height * 30;
+ this.tangScrollBar.Scroll += (sender, e) =>
+ {
+ tangRoll = e.NewValue / tangGridView.RowTemplate.Height;
+ tangGridView.FirstDisplayedScrollingRowIndex = tangRoll;
+ };
+ }
+
+ int maoRoll = -1;
+ private void InitMaoScrollBar()
+ {
+ maoScrollBar.Maximum = (maoGridView.RowCount - maoGridView.DisplayedRowCount(false) + 30) * maoGridView.RowTemplate.Height;
+ maoScrollBar.Minimum = 0;
+ maoScrollBar.SmallChange = maoGridView.RowTemplate.Height;
+ maoScrollBar.LargeChange = maoGridView.RowTemplate.Height * 30;
+ maoScrollBar.Scroll += (sender, e) =>
{
- leftRoll = e.NewValue / dataGridView.RowTemplate.Height;
- dataGridView.FirstDisplayedScrollingRowIndex = leftRoll;
+ maoRoll = e.NewValue / maoGridView.RowTemplate.Height;
+ maoGridView.FirstDisplayedScrollingRowIndex = maoRoll;
};
}
@@ -733,5 +947,106 @@ namespace WeighAndGrading
historyGrid.FirstDisplayedScrollingRowIndex = rightRoll;
};
}
+
+ object _fileSaveObj = new object();
+ void SaveEntityToLocal(bool tang)
+ {
+ lock (_fileSaveObj)
+ {
+ if (tang)
+ XmlUtil.SerializerObjToFile(localTang, tangFilePath);
+ else
+ XmlUtil.SerializerObjToFile(localMao, maoFilePath);
+ }
+ }
+
+ void SyncLocalMainFinish(ref List list, bool tang)
+ {
+ string path = maoFilePath;
+ short tech = MAO_TECH;
+ if (tang)
+ {
+ path = tangFilePath;
+ tech = TANG_TECH;
+ }
+
+ list = XmlUtil.DeserializeFromFile>(path);
+ var count = list.Count;
+ if (count == 0)
+ return;
+ if (count >= 30)
+ count = 30;
+
+ var sync = list.GetRange(0, count);
+ foreach (var item in sync)
+ {
+ GradeAndWeightRpc.SetGradeFinish(item, tech);
+ list.Remove(item);
+ }
+ SaveEntityToLocal(tang);
+ }
+
+ bool? last = null;
+ void VerifyConnection()
+ {
+ connection = LoginRpcUtil.TestConnection();
+ if (last == connection)
+ return;
+ var png = "stop.png";
+ if (connection)
+ png = "working.png";
+ var imgPath = Path.Combine(Application.StartupPath, "BWP.WinFormControl.dll");
+ var s = Assembly.LoadFile(imgPath).GetManifestResourceStream("BWP.WinFormControl.Images." + png);
+ statePic.Image = Image.FromStream(s);
+ statePic.Refresh();
+ last = connection;
+ }
+
+ private void GradeFrom_Load(object sender, EventArgs e)
+ {
+ syncToServer = new Thread(ToServerTask);
+ syncToServer.Start();
+ }
+
+ void ToServerTask()
+ {
+ while (true)
+ {
+ this.Invoke(new InvokeHandler(delegate()
+ {
+ VerifyConnection();
+ if (connection)
+ {
+ try
+ {
+ SyncLocalMainFinish(ref localTang, true);
+ SyncLocalMainFinish(ref localMao, false);
+ SyncDiscontToSever();
+ LocalGradeAndWeightBL.Sync();
+ }
+ catch (Exception ex)
+ {
+ File.WriteAllText(string.Format("{0:yyyyMMddHHmmss}log.txt", DateTime.Now), "错误:" + ex.Message + " \n详细信息:" + ex.StackTrace);
+ }
+ }
+ }));
+ Thread.Sleep(2000);
+ }
+ }
+
+ void SyncDiscontToSever()
+ {
+ var changeFlagPath = Path.Combine(GradeFrom.DATA_PATH, "DiscontsChanged.txt");
+ bool existFile = File.Exists(changeFlagPath);
+ if (existFile)
+ {
+ var list = XmlUtil.DeserializeFromFile>(discontPath);
+ var changes = new List>();
+ foreach (var item in list)
+ changes.Add(new CTuple(item.ID, item.Discont));
+ GradeAndWeightRpc.SaveBodyDiscontItem(changes);
+ File.Delete(changeFlagPath);
+ }
+ }
}
}
diff --git a/WeighAndGrading/GradeFrom.resx b/WeighAndGrading/GradeFrom.resx
index ecec308..7b5224b 100644
--- a/WeighAndGrading/GradeFrom.resx
+++ b/WeighAndGrading/GradeFrom.resx
@@ -117,52 +117,64 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
True
-
+
True
-
+
True
-
+
True
-
+
True
-
+
True
-
+
True
-
+
+ True
+
+
+ True
+
+
True
-
+
True
-
+
True
-
+
True
-
+
True
-
+
True
-
+
True
-
+
True
-
+
+ True
+
+
+ True
+
+
True
\ No newline at end of file
diff --git a/WeighAndGrading/Properties/Resources.Designer.cs b/WeighAndGrading/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..bb35fb0
--- /dev/null
+++ b/WeighAndGrading/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// 此代码由工具生成。
+// 运行时版本:4.0.30319.42000
+//
+// 对此文件的更改可能会导致不正确的行为,并且如果
+// 重新生成代码,这些更改将会丢失。
+//
+//------------------------------------------------------------------------------
+
+namespace WeighAndGrading.Properties {
+ using System;
+
+
+ ///
+ /// 一个强类型的资源类,用于查找本地化的字符串等。
+ ///
+ // 此类是由 StronglyTypedResourceBuilder
+ // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+ // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+ // (以 /str 作为命令选项),或重新生成 VS 项目。
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// 返回此类使用的缓存的 ResourceManager 实例。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WeighAndGrading.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// 使用此强类型资源类,为所有资源查找
+ /// 重写当前线程的 CurrentUICulture 属性。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/WeighAndGrading/Properties/Resources.resx b/WeighAndGrading/Properties/Resources.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/WeighAndGrading/Properties/Resources.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/WeighAndGrading/WeighAndGrading.csproj b/WeighAndGrading/WeighAndGrading.csproj
index 7e9f985..5d66b82 100644
--- a/WeighAndGrading/WeighAndGrading.csproj
+++ b/WeighAndGrading/WeighAndGrading.csproj
@@ -34,7 +34,6 @@
false
-
@@ -70,6 +69,11 @@
GradeSettingFrom.cs
+
+ True
+ True
+ Resources.resx
+
@@ -82,6 +86,10 @@
GradeSettingFrom.cs
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+