Browse Source

修改打印

master
wugang 8 years ago
parent
commit
052ecb1436
6 changed files with 354 additions and 151 deletions
  1. +26
    -9
      BO/Utils/BillRpc/GradeAndWeightRpc.cs
  2. +1
    -1
      BO/Utils/LoginRpcUtil.cs
  3. +4
    -0
      ButcherManageClient/ButcherManageClient.csproj
  4. +100
    -87
      WeighAndGrading/GradeFrom.Designer.cs
  5. +212
    -43
      WeighAndGrading/GradeFrom.cs
  6. +11
    -11
      WeighAndGrading/WeightGradePrint.cs

+ 26
- 9
BO/Utils/BillRpc/GradeAndWeightRpc.cs View File

@ -5,6 +5,7 @@ using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.SqlDoms; using Forks.EnterpriseServices.SqlDoms;
using Forks.JsonRpc.Client; using Forks.JsonRpc.Client;
using System; using System;
using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Linq; using System.Linq;
@ -71,7 +72,9 @@ namespace BO.Utils.BillRpc
return true; return true;
} }
catch catch
{ return false; }
{
return false;
}
} }
} }
@ -89,8 +92,8 @@ namespace BO.Utils.BillRpc
public static void DeleteBySID(long sid) public static void DeleteBySID(long sid)
{ {
var delDom=new DQDeleteDom(typeof(GradeAndWeight_Detail));
delDom.Where.Conditions.Add(DQCondition.EQ("SID",sid));
var delDom = new DQDeleteDom(typeof(GradeAndWeight_Detail));
delDom.Where.Conditions.Add(DQCondition.EQ("SID", sid));
using (var session = DmoSession.New()) using (var session = DmoSession.New())
{ {
session.ExecuteNonQuery(delDom); session.ExecuteNonQuery(delDom);
@ -113,8 +116,9 @@ namespace BO.Utils.BillRpc
public static BindingList<GradeAndWeight_Detail> GetDetails(DateTime date, int top = 15) public static BindingList<GradeAndWeight_Detail> GetDetails(DateTime date, int top = 15)
{ {
var bindList=new BindingList<GradeAndWeight_Detail>();
var list=new List<GradeAndWeight_Detail>();
var bindList = new BindingList<GradeAndWeight_Detail>();
// var bindList=new BlockingCollection<GradeAndWeight_Detail>();
var list = new List<GradeAndWeight_Detail>();
var query = new DmoQuery(typeof(GradeAndWeight_Detail)); var query = new DmoQuery(typeof(GradeAndWeight_Detail));
query.Where.Conditions.Add(DQCondition.EQ("Date", date)); query.Where.Conditions.Add(DQCondition.EQ("Date", date));
@ -122,7 +126,7 @@ namespace BO.Utils.BillRpc
query.Range = SelectRange.Top(top); query.Range = SelectRange.Top(top);
using (var session = DmoSession.New()) using (var session = DmoSession.New())
{ {
list= session.ExecuteList(query).Cast<GradeAndWeight_Detail>().ToList();
list = session.ExecuteList(query).Cast<GradeAndWeight_Detail>().ToList();
} }
foreach (GradeAndWeight_Detail detail in list) foreach (GradeAndWeight_Detail detail in list)
{ {
@ -142,6 +146,7 @@ namespace BO.Utils.BillRpc
return Convert.ToInt32(session.ExecuteScalar(query)); return Convert.ToInt32(session.ExecuteScalar(query));
} }
} }
public static int GetMaoBoSumNumber(DateTime date) public static int GetMaoBoSumNumber(DateTime date)
{ {
var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail))); var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail)));
@ -161,7 +166,7 @@ namespace BO.Utils.BillRpc
query.Where.Conditions.Add(DQCondition.EQ("IsLostWeight", true)); query.Where.Conditions.Add(DQCondition.EQ("IsLostWeight", true));
query.Where.Conditions.Add(DQCondition.EQ("Date", date)); query.Where.Conditions.Add(DQCondition.EQ("Date", date));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("Index", true)); query.OrderBy.Expressions.Add(DQOrderByExpression.Create("Index", true));
using (var session = DmoSession.New()) using (var session = DmoSession.New())
{ {
return session.ExecuteList(query).Cast<GradeAndWeight_Detail>().ToList(); return session.ExecuteList(query).Cast<GradeAndWeight_Detail>().ToList();
@ -222,7 +227,8 @@ namespace BO.Utils.BillRpc
var query = new DmoQuery(typeof(GradeAndWeight_Detail)); var query = new DmoQuery(typeof(GradeAndWeight_Detail));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("SID")); query.OrderBy.Expressions.Add(DQOrderByExpression.Create("SID"));
query.Range = SelectRange.Top(50); query.Range = SelectRange.Top(50);
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Sync", false), DQCondition.IsNotNull(DQExpression.Field("Technics"))));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Sync", false),
DQCondition.IsNotNull(DQExpression.Field("Technics"))));
return session.ExecuteList(query).Cast<GradeAndWeight_Detail>(); return session.ExecuteList(query).Cast<GradeAndWeight_Detail>();
} }
} }
@ -248,10 +254,21 @@ namespace BO.Utils.BillRpc
{ {
using (var session = DmoSession.New()) using (var session = DmoSession.New())
{ {
var record = new WeightData { Weight = weight, Time = DateTime.Now };
var record = new WeightData {Weight = weight, Time = DateTime.Now};
session.Insert(record); session.Insert(record);
session.Commit(); session.Commit();
} }
} }
public static int GetTodayTotalCount(DateTime date)
{
var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail)));
query.Columns.Add(DQSelectColumn.Count());
query.Where.Conditions.Add(DQCondition.EQ("Date", date));
using (var session = DmoSession.New())
{
return Convert.ToInt32(session.ExecuteScalar(query));
}
}
} }
} }

+ 1
- 1
BO/Utils/LoginRpcUtil.cs View File

@ -55,7 +55,7 @@ namespace BO.Utils
//{ //{
//HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); //HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
var uri = new Uri(url); var uri = new Uri(url);
return TestConnection(uri.Host, uri.Port, 50);
return TestConnection(uri.Host, uri.Port, 500);
// HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); // HttpWebResponse resp = (HttpWebResponse)req.GetResponse();


+ 4
- 0
ButcherManageClient/ButcherManageClient.csproj View File

@ -106,6 +106,10 @@
<Project>{a782b23e-be6d-4f51-b5cb-5cd259ba97cc}</Project> <Project>{a782b23e-be6d-4f51-b5cb-5cd259ba97cc}</Project>
<Name>BWP.WinFormControl</Name> <Name>BWP.WinFormControl</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\WeighAndGrading\WeighAndGrading.csproj">
<Project>{bfc366e2-994c-433f-9ee2-5377dba9d948}</Project>
<Name>WeighAndGrading</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="pig [128x128].ico" /> <Content Include="pig [128x128].ico" />


+ 100
- 87
WeighAndGrading/GradeFrom.Designer.cs View File

@ -28,19 +28,19 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle53 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle54 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle56 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle55 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle57 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle58 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle60 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle59 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle61 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle62 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle65 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle63 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle64 = 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 dataGridViewCellStyle43 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle42 = 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 dataGridViewCellStyle47 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle46 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle48 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle49 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle52 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle50 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle51 = new System.Windows.Forms.DataGridViewCellStyle();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.syncBtn = new System.Windows.Forms.Button(); this.syncBtn = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
@ -98,9 +98,10 @@
this.discontPanel = new System.Windows.Forms.FlowLayoutPanel(); this.discontPanel = new System.Windows.Forms.FlowLayoutPanel();
this.statePic = new System.Windows.Forms.PictureBox(); this.statePic = new System.Windows.Forms.PictureBox();
this.btnLockItem = new System.Windows.Forms.Button(); this.btnLockItem = new System.Windows.Forms.Button();
this.btnClearLast = new System.Windows.Forms.Button();
this.btnDeleteSelected = new System.Windows.Forms.Button();
this.btnAbnormalModify = new System.Windows.Forms.Button(); this.btnAbnormalModify = new System.Windows.Forms.Button();
this.lblSucessed = new System.Windows.Forms.Label(); this.lblSucessed = new System.Windows.Forms.Label();
this.btnClearWeight = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.tangGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tangGridView)).BeginInit();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
@ -216,17 +217,17 @@
this.tangGridView.AllowUserToDeleteRows = false; this.tangGridView.AllowUserToDeleteRows = false;
this.tangGridView.AllowUserToResizeColumns = false; this.tangGridView.AllowUserToResizeColumns = false;
this.tangGridView.AllowUserToResizeRows = false; this.tangGridView.AllowUserToResizeRows = false;
dataGridViewCellStyle53.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.tangGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle53;
dataGridViewCellStyle40.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.tangGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle40;
this.tangGridView.BackgroundColor = System.Drawing.Color.White; this.tangGridView.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle54.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle54.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle54.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle54.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle54.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle54.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle54.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.tangGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle54;
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.tangGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle41;
this.tangGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.tangGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.tangGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.tangGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.T_OrderDetail_ID, this.T_OrderDetail_ID,
@ -240,11 +241,11 @@
this.tangGridView.Name = "tangGridView"; this.tangGridView.Name = "tangGridView";
this.tangGridView.ReadOnly = true; this.tangGridView.ReadOnly = true;
this.tangGridView.RowHeadersVisible = false; this.tangGridView.RowHeadersVisible = false;
dataGridViewCellStyle56.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle56.ForeColor = System.Drawing.Color.Black;
dataGridViewCellStyle56.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
dataGridViewCellStyle56.SelectionForeColor = System.Drawing.Color.Black;
this.tangGridView.RowsDefaultCellStyle = dataGridViewCellStyle56;
dataGridViewCellStyle43.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle43.ForeColor = System.Drawing.Color.Black;
dataGridViewCellStyle43.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
dataGridViewCellStyle43.SelectionForeColor = System.Drawing.Color.Black;
this.tangGridView.RowsDefaultCellStyle = dataGridViewCellStyle43;
this.tangGridView.RowTemplate.Height = 50; this.tangGridView.RowTemplate.Height = 50;
this.tangGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; this.tangGridView.ScrollBars = System.Windows.Forms.ScrollBars.None;
this.tangGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.tangGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
@ -294,9 +295,9 @@
// //
// T_FinishBtn // T_FinishBtn
// //
dataGridViewCellStyle55.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle55.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10);
this.T_FinishBtn.DefaultCellStyle = dataGridViewCellStyle55;
dataGridViewCellStyle42.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle42.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10);
this.T_FinishBtn.DefaultCellStyle = dataGridViewCellStyle42;
this.T_FinishBtn.HeaderText = "完毕"; this.T_FinishBtn.HeaderText = "完毕";
this.T_FinishBtn.Name = "T_FinishBtn"; this.T_FinishBtn.Name = "T_FinishBtn";
this.T_FinishBtn.ReadOnly = true; this.T_FinishBtn.ReadOnly = true;
@ -328,17 +329,17 @@
this.maoGridView.AllowUserToDeleteRows = false; this.maoGridView.AllowUserToDeleteRows = false;
this.maoGridView.AllowUserToResizeColumns = false; this.maoGridView.AllowUserToResizeColumns = false;
this.maoGridView.AllowUserToResizeRows = false; this.maoGridView.AllowUserToResizeRows = false;
dataGridViewCellStyle57.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.maoGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle57;
dataGridViewCellStyle44.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.maoGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle44;
this.maoGridView.BackgroundColor = System.Drawing.Color.White; this.maoGridView.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle58.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle58.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle58.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle58.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle58.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle58.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle58.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.maoGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle58;
dataGridViewCellStyle45.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle45.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle45.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle45.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle45.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle45.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle45.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.maoGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle45;
this.maoGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.maoGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.maoGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.maoGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.M_OrderDetail_ID, this.M_OrderDetail_ID,
@ -352,11 +353,11 @@
this.maoGridView.Name = "maoGridView"; this.maoGridView.Name = "maoGridView";
this.maoGridView.ReadOnly = true; this.maoGridView.ReadOnly = true;
this.maoGridView.RowHeadersVisible = false; this.maoGridView.RowHeadersVisible = false;
dataGridViewCellStyle60.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle60.ForeColor = System.Drawing.Color.Black;
dataGridViewCellStyle60.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
dataGridViewCellStyle60.SelectionForeColor = System.Drawing.Color.Black;
this.maoGridView.RowsDefaultCellStyle = dataGridViewCellStyle60;
dataGridViewCellStyle47.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle47.ForeColor = System.Drawing.Color.Black;
dataGridViewCellStyle47.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
dataGridViewCellStyle47.SelectionForeColor = System.Drawing.Color.Black;
this.maoGridView.RowsDefaultCellStyle = dataGridViewCellStyle47;
this.maoGridView.RowTemplate.Height = 50; this.maoGridView.RowTemplate.Height = 50;
this.maoGridView.ScrollBars = System.Windows.Forms.ScrollBars.Horizontal; this.maoGridView.ScrollBars = System.Windows.Forms.ScrollBars.Horizontal;
this.maoGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.maoGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
@ -406,9 +407,9 @@
// //
// M_FinishBtn // M_FinishBtn
// //
dataGridViewCellStyle59.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle59.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10);
this.M_FinishBtn.DefaultCellStyle = dataGridViewCellStyle59;
dataGridViewCellStyle46.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle46.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10);
this.M_FinishBtn.DefaultCellStyle = dataGridViewCellStyle46;
this.M_FinishBtn.HeaderText = "完毕"; this.M_FinishBtn.HeaderText = "完毕";
this.M_FinishBtn.Name = "M_FinishBtn"; this.M_FinishBtn.Name = "M_FinishBtn";
this.M_FinishBtn.ReadOnly = true; this.M_FinishBtn.ReadOnly = true;
@ -478,17 +479,17 @@
this.historyGrid.AllowUserToDeleteRows = false; this.historyGrid.AllowUserToDeleteRows = false;
this.historyGrid.AllowUserToResizeColumns = false; this.historyGrid.AllowUserToResizeColumns = false;
this.historyGrid.AllowUserToResizeRows = false; this.historyGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle61.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.historyGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle61;
dataGridViewCellStyle48.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.historyGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle48;
this.historyGrid.BackgroundColor = System.Drawing.Color.White; this.historyGrid.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle62.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle62.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle62.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle62.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle62.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle62.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle62.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.historyGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle62;
dataGridViewCellStyle49.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle49.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle49.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle49.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle49.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle49.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle49.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.historyGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle49;
this.historyGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.historyGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.historyGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.historyGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.H_SID, this.H_SID,
@ -505,9 +506,9 @@
this.historyGrid.Name = "historyGrid"; this.historyGrid.Name = "historyGrid";
this.historyGrid.ReadOnly = true; this.historyGrid.ReadOnly = true;
this.historyGrid.RowHeadersVisible = false; this.historyGrid.RowHeadersVisible = false;
dataGridViewCellStyle65.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle65.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.historyGrid.RowsDefaultCellStyle = dataGridViewCellStyle65;
dataGridViewCellStyle52.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle52.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.historyGrid.RowsDefaultCellStyle = dataGridViewCellStyle52;
this.historyGrid.RowTemplate.Height = 40; this.historyGrid.RowTemplate.Height = 40;
this.historyGrid.ScrollBars = System.Windows.Forms.ScrollBars.None; this.historyGrid.ScrollBars = System.Windows.Forms.ScrollBars.None;
this.historyGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.historyGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
@ -573,8 +574,8 @@
// H_Weight // H_Weight
// //
this.H_Weight.DataPropertyName = "Weight"; this.H_Weight.DataPropertyName = "Weight";
dataGridViewCellStyle63.Format = "#0.######";
this.H_Weight.DefaultCellStyle = dataGridViewCellStyle63;
dataGridViewCellStyle50.Format = "#0.######";
this.H_Weight.DefaultCellStyle = dataGridViewCellStyle50;
this.H_Weight.HeaderText = "重量"; this.H_Weight.HeaderText = "重量";
this.H_Weight.Name = "H_Weight"; this.H_Weight.Name = "H_Weight";
this.H_Weight.ReadOnly = true; this.H_Weight.ReadOnly = true;
@ -583,9 +584,9 @@
// H_Time // H_Time
// //
this.H_Time.DataPropertyName = "Time"; this.H_Time.DataPropertyName = "Time";
dataGridViewCellStyle64.Format = "HH:mm:ss";
dataGridViewCellStyle64.NullValue = null;
this.H_Time.DefaultCellStyle = dataGridViewCellStyle64;
dataGridViewCellStyle51.Format = "HH:mm:ss";
dataGridViewCellStyle51.NullValue = null;
this.H_Time.DefaultCellStyle = dataGridViewCellStyle51;
this.H_Time.HeaderText = "时间"; this.H_Time.HeaderText = "时间";
this.H_Time.Name = "H_Time"; this.H_Time.Name = "H_Time";
this.H_Time.ReadOnly = true; this.H_Time.ReadOnly = true;
@ -605,7 +606,6 @@
// //
// isPrintCheckBox // isPrintCheckBox
// //
this.isPrintCheckBox.AutoCheck = false;
this.isPrintCheckBox.AutoSize = true; this.isPrintCheckBox.AutoSize = true;
this.isPrintCheckBox.Font = new System.Drawing.Font("宋体", 15F); this.isPrintCheckBox.Font = new System.Drawing.Font("宋体", 15F);
this.isPrintCheckBox.Location = new System.Drawing.Point(277, 2); this.isPrintCheckBox.Location = new System.Drawing.Point(277, 2);
@ -622,7 +622,7 @@
this.printBtn.Name = "printBtn"; this.printBtn.Name = "printBtn";
this.printBtn.Size = new System.Drawing.Size(102, 43); this.printBtn.Size = new System.Drawing.Size(102, 43);
this.printBtn.TabIndex = 29; this.printBtn.TabIndex = 29;
this.printBtn.Text = "打印测试";
this.printBtn.Text = "打印选中";
this.printBtn.UseVisualStyleBackColor = true; this.printBtn.UseVisualStyleBackColor = true;
this.printBtn.Click += new System.EventHandler(this.printBtn_Click); this.printBtn.Click += new System.EventHandler(this.printBtn_Click);
// //
@ -663,9 +663,9 @@
// closeBtn // closeBtn
// //
this.closeBtn.Font = new System.Drawing.Font("宋体", 15F); this.closeBtn.Font = new System.Drawing.Font("宋体", 15F);
this.closeBtn.Location = new System.Drawing.Point(1256, 20);
this.closeBtn.Location = new System.Drawing.Point(1256, 6);
this.closeBtn.Name = "closeBtn"; this.closeBtn.Name = "closeBtn";
this.closeBtn.Size = new System.Drawing.Size(102, 60);
this.closeBtn.Size = new System.Drawing.Size(102, 54);
this.closeBtn.TabIndex = 33; this.closeBtn.TabIndex = 33;
this.closeBtn.Text = "关闭"; this.closeBtn.Text = "关闭";
this.closeBtn.UseVisualStyleBackColor = true; this.closeBtn.UseVisualStyleBackColor = true;
@ -746,7 +746,7 @@
// btnLockItem // btnLockItem
// //
this.btnLockItem.Font = new System.Drawing.Font("宋体", 15F); this.btnLockItem.Font = new System.Drawing.Font("宋体", 15F);
this.btnLockItem.Location = new System.Drawing.Point(867, 2);
this.btnLockItem.Location = new System.Drawing.Point(606, 1);
this.btnLockItem.Name = "btnLockItem"; this.btnLockItem.Name = "btnLockItem";
this.btnLockItem.Size = new System.Drawing.Size(102, 25); this.btnLockItem.Size = new System.Drawing.Size(102, 25);
this.btnLockItem.TabIndex = 34; this.btnLockItem.TabIndex = 34;
@ -755,23 +755,23 @@
this.btnLockItem.Visible = false; this.btnLockItem.Visible = false;
this.btnLockItem.Click += new System.EventHandler(this.btnLockItem_Click); this.btnLockItem.Click += new System.EventHandler(this.btnLockItem_Click);
// //
// btnClearLast
// btnDeleteSelected
// //
this.btnClearLast.Font = new System.Drawing.Font("宋体", 15F);
this.btnClearLast.Location = new System.Drawing.Point(1011, 20);
this.btnClearLast.Name = "btnClearLast";
this.btnClearLast.Size = new System.Drawing.Size(102, 60);
this.btnClearLast.TabIndex = 34;
this.btnClearLast.Text = "删除";
this.btnClearLast.UseVisualStyleBackColor = true;
this.btnClearLast.Click += new System.EventHandler(this.btnClearLast_Click);
this.btnDeleteSelected.Font = new System.Drawing.Font("宋体", 15F);
this.btnDeleteSelected.Location = new System.Drawing.Point(1011, 6);
this.btnDeleteSelected.Name = "btnDeleteSelected";
this.btnDeleteSelected.Size = new System.Drawing.Size(102, 54);
this.btnDeleteSelected.TabIndex = 34;
this.btnDeleteSelected.Text = "删除选中";
this.btnDeleteSelected.UseVisualStyleBackColor = true;
this.btnDeleteSelected.Click += new System.EventHandler(this.btnDeleteSelected_Click);
// //
// btnAbnormalModify // btnAbnormalModify
// //
this.btnAbnormalModify.Font = new System.Drawing.Font("宋体", 15F); this.btnAbnormalModify.Font = new System.Drawing.Font("宋体", 15F);
this.btnAbnormalModify.Location = new System.Drawing.Point(1133, 20);
this.btnAbnormalModify.Location = new System.Drawing.Point(1133, 6);
this.btnAbnormalModify.Name = "btnAbnormalModify"; this.btnAbnormalModify.Name = "btnAbnormalModify";
this.btnAbnormalModify.Size = new System.Drawing.Size(102, 60);
this.btnAbnormalModify.Size = new System.Drawing.Size(102, 54);
this.btnAbnormalModify.TabIndex = 34; this.btnAbnormalModify.TabIndex = 34;
this.btnAbnormalModify.Text = "异常"; this.btnAbnormalModify.Text = "异常";
this.btnAbnormalModify.UseVisualStyleBackColor = true; this.btnAbnormalModify.UseVisualStyleBackColor = true;
@ -790,11 +790,22 @@
this.lblSucessed.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblSucessed.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.lblSucessed.Visible = false; this.lblSucessed.Visible = false;
// //
// btnClearWeight
//
this.btnClearWeight.Font = new System.Drawing.Font("宋体", 15F);
this.btnClearWeight.Location = new System.Drawing.Point(880, 6);
this.btnClearWeight.Name = "btnClearWeight";
this.btnClearWeight.Size = new System.Drawing.Size(102, 54);
this.btnClearWeight.TabIndex = 34;
this.btnClearWeight.Text = "删除称重";
this.btnClearWeight.UseVisualStyleBackColor = true;
this.btnClearWeight.Click += new System.EventHandler(this.btnClearLastWeight_Click);
//
// GradeFrom // GradeFrom
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1382, 843);
this.ClientSize = new System.Drawing.Size(1382, 840);
this.Controls.Add(this.lblSucessed); this.Controls.Add(this.lblSucessed);
this.Controls.Add(this.statePic); this.Controls.Add(this.statePic);
this.Controls.Add(this.discontPanel); this.Controls.Add(this.discontPanel);
@ -802,7 +813,8 @@
this.Controls.Add(this.discontBtn); this.Controls.Add(this.discontBtn);
this.Controls.Add(this.modifyPanel); this.Controls.Add(this.modifyPanel);
this.Controls.Add(this.btnAbnormalModify); this.Controls.Add(this.btnAbnormalModify);
this.Controls.Add(this.btnClearLast);
this.Controls.Add(this.btnClearWeight);
this.Controls.Add(this.btnDeleteSelected);
this.Controls.Add(this.btnLockItem); this.Controls.Add(this.btnLockItem);
this.Controls.Add(this.configBtn); this.Controls.Add(this.configBtn);
this.Controls.Add(this.closeBtn); this.Controls.Add(this.closeBtn);
@ -881,7 +893,7 @@
private BWP.WinFormControl.UDataGridView maoGridView; private BWP.WinFormControl.UDataGridView maoGridView;
private System.Windows.Forms.PictureBox statePic; private System.Windows.Forms.PictureBox statePic;
private System.Windows.Forms.Button btnLockItem; private System.Windows.Forms.Button btnLockItem;
private System.Windows.Forms.Button btnClearLast;
private System.Windows.Forms.Button btnDeleteSelected;
private System.Windows.Forms.Button btnAbnormalModify; private System.Windows.Forms.Button btnAbnormalModify;
private System.Windows.Forms.DataGridViewTextBoxColumn T_OrderDetail_ID; private System.Windows.Forms.DataGridViewTextBoxColumn T_OrderDetail_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn T_Finish; private System.Windows.Forms.DataGridViewTextBoxColumn T_Finish;
@ -906,5 +918,6 @@
private System.Windows.Forms.DataGridViewTextBoxColumn H_Time; private System.Windows.Forms.DataGridViewTextBoxColumn H_Time;
private System.Windows.Forms.Label lblHeJi; private System.Windows.Forms.Label lblHeJi;
private System.Windows.Forms.Label lblSucessed; private System.Windows.Forms.Label lblSucessed;
private System.Windows.Forms.Button btnClearWeight;
} }
} }

+ 212
- 43
WeighAndGrading/GradeFrom.cs View File

@ -133,15 +133,50 @@ namespace WeighAndGrading
SetlblSucessVisibleTrue(); SetlblSucessVisibleTrue();
var livestockTag = btn.Tag as CTuple<long, string, short, string>; var livestockTag = btn.Tag as CTuple<long, string, short, string>;
var tech = livestockTag.Item3 == TANG_TECH ? "烫褪" : "毛剥";
if (modifyDetail == null) if (modifyDetail == null)
{
StartPrintEntity(tech,null);
AddDetail(livestockTag); AddDetail(livestockTag);
}
else else
{ {
StartPrintEntity(tech, modifyDetail.Index);
modifyDetail.Livestock_ID = livestockTag.Item1; modifyDetail.Livestock_ID = livestockTag.Item1;
modifyDetail.Livestock_Name = livestockTag.Item2; modifyDetail.Livestock_Name = livestockTag.Item2;
modifyDetail.Technics = livestockTag.Item3; modifyDetail.Technics = livestockTag.Item3;
modifyDetail.Technics_Name = livestockTag.Item3 == TANG_TECH ? "烫褪" : "毛剥"; modifyDetail.Technics_Name = livestockTag.Item3 == TANG_TECH ? "烫褪" : "毛剥";
LocalGradeAndWeightBL.Update(modifyDetail, "Livestock_ID", "Livestock_Name", "Technics", "Technics_Name"); LocalGradeAndWeightBL.Update(modifyDetail, "Livestock_ID", "Livestock_Name", "Technics", "Technics_Name");
noLivestockList = new ConcurrentQueue<GradeAndWeight_Detail>();
var stack = new Stack<GradeAndWeight_Detail>();
//找到锁定的最大id
long suodingmaxsid = 0;
var lostweightlist = details.Where(x => x.IsLostWeight).ToList();
if (lostweightlist.Count > 0)
{
suodingmaxsid = lostweightlist.Max(x => x.SID);
}
//把没有级别的记录加进去
var livestockNoNameList = details.Where(x => string.IsNullOrWhiteSpace(x.Livestock_Name));
foreach (var item in livestockNoNameList)
{
if (item.SID > suodingmaxsid)
{
stack.Push(item);
}
}
while (stack.Count > 0)
{
noLivestockList.Enqueue(stack.Pop());
}
historyGrid.Refresh(); historyGrid.Refresh();
modifyDetail = null; modifyDetail = null;
modifyPanel.Hide(); modifyPanel.Hide();
@ -203,15 +238,15 @@ namespace WeighAndGrading
}; };
if (item.Item3 == TANG_TECH) if (item.Item3 == TANG_TECH)
{ {
btn.KeyDown += Btn_KeyDown;
btn.KeyUp += Btn_KeyUp;
// btn.KeyDown += Btn_KeyDown;
// btn.KeyUp += Btn_KeyUp;
ttPanel.Controls.Add(btn); ttPanel.Controls.Add(btn);
} }
else else
{ {
btn.KeyDown += Btn_KeyDown;
btn.KeyUp += Btn_KeyUp;
// btn.KeyDown += Btn_KeyDown;
// btn.KeyUp += Btn_KeyUp;
mbPanel.Controls.Add(btn); mbPanel.Controls.Add(btn);
} }
@ -220,17 +255,7 @@ namespace WeighAndGrading
SetMargin(mbPanel); SetMargin(mbPanel);
} }
private void Btn_KeyUp(object sender, KeyEventArgs e)
{
var btn = sender as Button;
btn.BackColor = SystemColors.Control;
}
private void Btn_KeyDown(object sender, KeyEventArgs e)
{
var btn = sender as Button;
btn.BackColor = Color.Aqua;
}
// private void SetJiBieSelectBackColor(string btnText) // private void SetJiBieSelectBackColor(string btnText)
// { // {
@ -322,7 +347,7 @@ namespace WeighAndGrading
var stack = new Stack<GradeAndWeight_Detail>(); var stack = new Stack<GradeAndWeight_Detail>();
foreach (var item in details) foreach (var item in details)
{ {
if (item.Livestock_ID == 0 || item.Weight == null)
if (item.Livestock_ID == 0 || item.Weight == null||string.IsNullOrWhiteSpace(item.Livestock_Name))
stack.Push(item); stack.Push(item);
else else
break; break;
@ -468,26 +493,86 @@ namespace WeighAndGrading
rightRoll = -1; rightRoll = -1;
} }
historyGrid.Refresh(); historyGrid.Refresh();
SetHistorBackColor();
// SetHistorBackColor();
ReSetHistorySum(); ReSetHistorySum();
} }
private void printBtn_Click(object sender, EventArgs e)
void StartPrintEntity(string gongyijibie,int? index)
{ {
if (!isPrintCheckBox.Checked)
{
return;
}
if (string.IsNullOrWhiteSpace(gongyijibie))
{
return;
}
var entity = CreatePrintEntity(gongyijibie, index);
WeightGradePrint.Print(entity);
}
PrintEntity CreatePrintEntity(string jibie,int? index)
{
string goodsName;
if (jibie == "烫褪")
{
goodsName = "带皮白条";
}
else
{
goodsName = "去皮白条";
}
var entity = new PrintEntity(); var entity = new PrintEntity();
entity.AccountingUnit_Name = "青花瓷软件(北京)有限公司";
entity.Goods_Name = "B2/B3 ERP";
entity.AccountingUnit_Name = "青岛万福集团股份有限公司";
entity.Goods_Name = goodsName;
entity.Date = DateTime.Today; 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);
WeightGradePrint.Print(entity);
entity.Checker = "";
entity.StoreCondition = "0-4℃";
entity.Place = "青岛莱西市";
entity.TelNumber = "0532-88488888";
int maxindex;
if (index == null)
{
maxindex = LocalGradeAndWeightBL.GetTodayTotalCount(butcherTimeInput.Date.Value);
maxindex++;
}
else
{
maxindex = index.Value;
}
string indexCode = maxindex.ToString("D6");
entity.BarCode = string.Format("WF{0}{1:00000}", DateTime.Today.ToString("yyyyMMdd"), indexCode);
entity._2DQRCode = string.Format("http://www.bwpsoft.com?code={0}&name={1}", entity.BarCode,goodsName);
return entity;
} }
private void printBtn_Click(object sender, EventArgs e)
{
if (modifyDetail == null)
{
return;
}
StartPrintEntity(modifyDetail.Technics_Name, modifyDetail.Index);
modifyDetail = null;
modifyPanel.Hide();
}
// void Print(object obj)
// {
// var entity = obj as PrintEntity;
// this.Invoke(new Action(() =>
// {
// WeightGradePrint.Print(entity);
// }));
// }
private void configBtn_Click(object sender, EventArgs e) private void configBtn_Click(object sender, EventArgs e)
{ {
new GradeSettingFrom().ShowDialog(); new GradeSettingFrom().ShowDialog();
@ -802,7 +887,7 @@ namespace WeighAndGrading
var tech = livestock.Item3 == TANG_TECH ? "烫褪" : "毛剥"; var tech = livestock.Item3 == TANG_TECH ? "烫褪" : "毛剥";
GradeAndWeight_Detail first; GradeAndWeight_Detail first;
if (noLivestockList.TryPeek(out first) && first.Livestock_ID == null)
if (noLivestockList.TryPeek(out first) && string.IsNullOrWhiteSpace(first.Livestock_Name))
{ {
noLivestockList.TryDequeue(out first); noLivestockList.TryDequeue(out first);
if (currentRow != null) if (currentRow != null)
@ -942,10 +1027,83 @@ namespace WeighAndGrading
} }
private void btnClearLast_Click(object sender, EventArgs e)
private void btnDeleteSelected_Click(object sender, EventArgs e)
{ {
if (MessageBox.Show("确定删除选中一条称重记录?", "删除选中", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
{
return;
}
if (MessageBox.Show("确定删除最后一条记录?", "确定删除最后一条记录?", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
if (lastCheckItem == null)
{
return;
}
//如果没有选中
if (!lastCheckItem.ReadWeight)
{
return;
}
//删除选中
LocalGradeAndWeightBL.DeleteBySID(lastCheckItem.SID);
details.Remove(lastCheckItem);
//找到锁定的最大id
long suodingmaxsid = 0;
var lostweightlist = details.Where(x => x.IsLostWeight).ToList();
if (lostweightlist.Count > 0)
{
suodingmaxsid = lostweightlist.Max(x => x.SID);
}
//重新赋值 队列
//重新设置没有级别的
noLivestockList = new ConcurrentQueue<GradeAndWeight_Detail>();
var stackNoLiveStock = new Stack<GradeAndWeight_Detail>();
//把没有级别的记录加进去
var livestockNoNameList = details.Where(x => string.IsNullOrWhiteSpace(x.Livestock_Name));
foreach (var item in livestockNoNameList)
{
if (item.SID > suodingmaxsid)
{
stackNoLiveStock.Push(item);
}
}
while (stackNoLiveStock.Count > 0)
{
noLivestockList.Enqueue(stackNoLiveStock.Pop());
}
//重新设置没有重量的
noWeightList = new ConcurrentQueue<GradeAndWeight_Detail>();
var stackNoWeight = new Stack<GradeAndWeight_Detail>();
//把没有重量的记录加进去
var noWeightDetails = details.Where(x => x.Weight==null);
foreach (var item in noWeightDetails)
{
if (item.SID > suodingmaxsid)
{
stackNoWeight.Push(item);
}
}
while (stackNoWeight.Count > 0)
{
noWeightList.Enqueue(stackNoWeight.Pop());
}
}
private void btnClearLastWeight_Click(object sender, EventArgs e)
{
if (MessageBox.Show("确定删除最后一条称重记录?", "删除称重", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
{ {
return; return;
} }
@ -997,6 +1155,9 @@ namespace WeighAndGrading
details.RemoveAt(0); details.RemoveAt(0);
//删除数据库 //删除数据库
LocalGradeAndWeightBL.DeleteBySID(lastItem.SID); LocalGradeAndWeightBL.DeleteBySID(lastItem.SID);
historyGrid.Rows[0].Selected = true;
historyGrid.FirstDisplayedScrollingRowIndex = 0;
vScrollBar2.Value = 0;
historyGrid.Refresh(); historyGrid.Refresh();
@ -1017,7 +1178,12 @@ namespace WeighAndGrading
var stack = new Stack<GradeAndWeight_Detail>(); var stack = new Stack<GradeAndWeight_Detail>();
//找到锁定的最大id //找到锁定的最大id
var suodingmaxsid = details.Where(x => x.IsLostWeight).Max(x => x.SID);
long suodingmaxsid = 0;
var lostweightlist = details.Where(x => x.IsLostWeight).ToList();
if (lostweightlist.Count > 0)
{
suodingmaxsid = lostweightlist.Max(x => x.SID);
}
//把没有级别的记录加进去 //把没有级别的记录加进去
var livestockNoNameList = details.Where(x => string.IsNullOrWhiteSpace(x.Livestock_Name)); var livestockNoNameList = details.Where(x => string.IsNullOrWhiteSpace(x.Livestock_Name));
foreach (var item in livestockNoNameList) foreach (var item in livestockNoNameList)
@ -1075,19 +1241,19 @@ namespace WeighAndGrading
} }
} }
SetHistorBackColor();
// SetHistorBackColor();
} }
void SetHistorBackColor()
{
foreach (DataGridViewRow row in historyGrid.Rows)
{
if ((bool)row.Cells["IsLostWeight"].Value)
row.DefaultCellStyle.ForeColor = Color.Red;
}
}
// void SetHistorBackColor()
// {
// foreach (DataGridViewRow row in historyGrid.Rows)
// {
// if ((bool)row.Cells["IsLostWeight"].Value)
// row.DefaultCellStyle.ForeColor = Color.Red;
// }
// }
private void UpdateItemLosted(long sid) private void UpdateItemLosted(long sid)
{ {
@ -1284,12 +1450,12 @@ namespace WeighAndGrading
{ {
if (modifyDetail == null) if (modifyDetail == null)
{ {
if (disBtn != null)
SetBtnUnCheck(disBtn);
// if (disBtn != null)
// SetBtnUnCheck(disBtn);
if (disBtn != btn) if (disBtn != btn)
{ {
disBtn = btn; disBtn = btn;
SetBtnChecked(disBtn);
// SetBtnChecked(disBtn);
} }
else else
disBtn = null; disBtn = null;
@ -1358,6 +1524,7 @@ namespace WeighAndGrading
vScrollBar2.Minimum = 0; vScrollBar2.Minimum = 0;
vScrollBar2.SmallChange = historyGrid.RowTemplate.Height; vScrollBar2.SmallChange = historyGrid.RowTemplate.Height;
vScrollBar2.LargeChange = historyGrid.RowTemplate.Height * 30; vScrollBar2.LargeChange = historyGrid.RowTemplate.Height * 30;
this.vScrollBar2.Scroll += (sender, e) => this.vScrollBar2.Scroll += (sender, e) =>
{ {
rightRoll = e.NewValue / historyGrid.RowTemplate.Height; rightRoll = e.NewValue / historyGrid.RowTemplate.Height;
@ -1442,6 +1609,8 @@ namespace WeighAndGrading
f.ShowDialog(); f.ShowDialog();
} }
private void GradeFrom_Load(object sender, EventArgs e) private void GradeFrom_Load(object sender, EventArgs e)
{ {
syncToServer = new Thread(ToServerTask); syncToServer = new Thread(ToServerTask);


+ 11
- 11
WeighAndGrading/WeightGradePrint.cs View File

@ -15,20 +15,20 @@ namespace WeighAndGrading
PrintAPI.B_EnumUSB(new byte[128]); PrintAPI.B_EnumUSB(new byte[128]);
PrintAPI.B_CreateUSBPort(1); PrintAPI.B_CreateUSBPort(1);
PrintAPI.B_Prn_Text_TrueType(110, 31, 31, "宋体", 1, 700, 0, 0, 0, "C1", entity.AccountingUnit_Name);
PrintAPI.B_Prn_Text_TrueType(42, 75, 31, "宋体", 1, 700, 0, 0, 0, "C2", "合格证");
PrintAPI.B_Prn_Text_TrueType(440, 75, 31, "宋体", 1, 700, 0, 0, 0, "C3", entity.Goods_Name);
PrintAPI.B_Prn_Text_TrueType(110, 26, 31, "宋体", 1, 700, 0, 0, 0, "C1", entity.AccountingUnit_Name);
PrintAPI.B_Prn_Text_TrueType(42, 70, 31, "宋体", 1, 700, 0, 0, 0, "C2", "合格证");
PrintAPI.B_Prn_Text_TrueType(440, 70, 31, "宋体", 1, 700, 0, 0, 0, "C3", entity.Goods_Name);
PrintAPI.B_Prn_Text_TrueType(42, 125, 27, "宋体", 1, 400, 0, 0, 0, "C4", string.Format("生产日期:{0}", entity.Date.ToString("yyyy/MM/dd")));
PrintAPI.B_Prn_Text_TrueType(42, 165, 27, "宋体", 1, 400, 0, 0, 0, "C5", string.Format("检 验 员:{0}", entity.Checker));
PrintAPI.B_Prn_Text_TrueType(42, 205, 27, "宋体", 1, 400, 0, 0, 0, "C6", string.Format("保 质 期:{0}", entity.StoreCondition));
PrintAPI.B_Prn_Text_TrueType(42, 120, 27, "宋体", 1, 400, 0, 0, 0, "C4", string.Format("生产日期:{0}", entity.Date.ToString("yyyy/MM/dd")));
PrintAPI.B_Prn_Text_TrueType(42, 160, 27, "宋体", 1, 400, 0, 0, 0, "C5", string.Format("检 验 员:{0}", entity.Checker));
PrintAPI.B_Prn_Text_TrueType(42, 200, 27, "宋体", 1, 400, 0, 0, 0, "C6", string.Format("保 质 期:{0}", entity.StoreCondition));
PrintAPI.B_Prn_Text_TrueType(42, 255, 23, "宋体", 1, 400, 0, 0, 0, "C7", string.Format("产地:{0} 电话:{1}", entity.Place, entity.TelNumber));
PrintAPI.B_Prn_Text_TrueType(42, 290, 23, "宋体", 1, 400, 0, 0, 0, "C8", string.Format("地:{0}", entity.Address));
PrintAPI.B_Prn_Text_TrueType(42, 240, 23, "宋体", 1, 400, 0, 0, 0, "C7", string.Format("电话:{0}", entity.TelNumber));
PrintAPI.B_Prn_Text_TrueType(42, 280, 23, "宋体", 1, 400, 0, 0, 0, "C8", string.Format("地:{0}", entity.Place));
PrintAPI.B_Prn_Barcode(42, 330, 0, "1", 3, 22, 35, 'N', entity.BarCode);
PrintAPI.B_Prn_Text_TrueType(175, 370, 25, "宋体", 1, 500, 0, 0, 0, "C9", entity.BarCode);
PrintAPI.B_Bar2d_QR(430, 120, 2, 7, 'M', 'A', 0, 0, 0, entity._2DQRCode);
PrintAPI.B_Prn_Barcode(42, 320, 0, "1", 3, 22, 35, 'N', entity.BarCode);
PrintAPI.B_Prn_Text_TrueType(173, 360, 25, "宋体", 1, 500, 0, 0, 0, "C9", entity.BarCode);
PrintAPI.B_Bar2d_QR(430, 105, 2, 6, 'M', 'A', 0, 0, 0, entity._2DQRCode);
PrintAPI.B_Set_Direction('B'); PrintAPI.B_Set_Direction('B');
PrintAPI.B_Print_Out(1); PrintAPI.B_Print_Out(1);


Loading…
Cancel
Save