Browse Source

调整。

master
yibo 7 years ago
parent
commit
2cc0bd3299
6 changed files with 336 additions and 235 deletions
  1. +4
    -0
      BO/BO/Bill/GradeAndWeight/GradeAndWeight_Detail.cs
  2. +76
    -9
      BO/Utils/BillRpc/GradeAndWeightRpc.cs
  3. +226
    -215
      WeighAndGrading/GradeFrom.Designer.cs
  4. +22
    -6
      WeighAndGrading/GradeFrom.cs
  5. +3
    -0
      WeighAndGrading/GradeFrom.resx
  6. +5
    -5
      WeighAndGrading/WeightGradePrint.cs

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

@ -1,6 +1,7 @@
using Forks.EnterpriseServices.DomainObjects2; using Forks.EnterpriseServices.DomainObjects2;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -23,6 +24,8 @@ namespace BO.BO.Bill
public int Index { get; set; } public int Index { get; set; }
public int? OrderIndex { get; set; }
public DateTime Date { get; set; } public DateTime Date { get; set; }
public short? Technics { get; set; } public short? Technics { get; set; }
@ -35,6 +38,7 @@ namespace BO.BO.Bill
public decimal? Weight { get; set; } public decimal? Weight { get; set; }
[DbColumn(DbType = SqlDbType.DateTime)]
public DateTime Time { get; set; } public DateTime Time { get; set; }
/// <summary> /// <summary>


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

@ -295,20 +295,24 @@ namespace BO.Utils.BillRpc
} }
} }
public static int GetOrderIndex(DateTime date, GradeAndWeight_Detail detail)
public static Dictionary<int,int> GetOrderIdx(DateTime date)
{ {
var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail))); var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail)));
query.Columns.Add(DQSelectColumn.Count());
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("IsDeleted", false), DQCondition.EQ("Order", detail.Order), DQCondition.EQ("Date", date)));
if (detail.SID != 0)
query.Where.Conditions.Add(DQCondition.LessThanOrEqual("SID", detail.SID));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Date", date), DQCondition.IsNotNull(DQExpression.Field("Order")), DQCondition.IsNotNull(DQExpression.Field("OrderIndex"))));
query.Columns.Add(DQSelectColumn.Field("Order"));
query.Columns.Add(DQSelectColumn.Max("OrderIndex"));
query.GroupBy.Expressions.Add(DQExpression.Field("Order"));
var dic = new Dictionary<int, int>();
using (var session = LocalDmoSession.New()) using (var session = LocalDmoSession.New())
{ {
var orderIdx = Convert.ToInt32(session.ExecuteScalar(query));
if (detail.SID == 0)
orderIdx += 1;
return orderIdx;
using (var reader = session.ExecuteReader(query))
{
while (reader.Read())
dic.Add((int)reader[0], (int)reader[1]);
}
} }
return dic;
} }
public static List<GradeAndWeight_Detail> GetGradeAndWeightDetails(DateTime date, int? order, int? index, short? type) public static List<GradeAndWeight_Detail> GetGradeAndWeightDetails(DateTime date, int? order, int? index, short? type)
@ -340,5 +344,68 @@ namespace BO.Utils.BillRpc
else else
Update(entity, "Technics", "Technics_Name", "Index", "Order", "Weight", "Livestock_ID", "Livestock_Name"); Update(entity, "Technics", "Technics_Name", "Index", "Order", "Weight", "Livestock_ID", "Livestock_Name");
} }
public static void UpdateHistory(DateTime dateTime)
{
var lastOrder = 0;
var orderIdx=1;
using (var session = LocalDmoSession.New())
{
if (CheckTodayUpdated(dateTime, session))
return;
var list = Get20180411Data(dateTime, session);
foreach (var item in list)
{
if (item.Item1 == lastOrder)
{
orderIdx++;
UpdateOrderIdx(item.Item2, orderIdx, session);
}
else
{
lastOrder = item.Item1;
orderIdx = 1;
UpdateOrderIdx(item.Item2, orderIdx, session);
}
}
session.Commit();
}
}
static bool CheckTodayUpdated(DateTime dateTime, IDmoSession session)
{
var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail)));
query.Columns.Add(DQSelectColumn.Field("SID"));
query.Where.Conditions.Add(DQCondition.And( DQCondition.EQ("Date", dateTime), DQCondition.IsNotNull(DQExpression.Field("OrderIndex"))));
return session.ExecuteScalar(query) != null;
}
private static void UpdateOrderIdx(long sid, int orderIdx, IDmoSession session)
{
var update = new DQUpdateDom(typeof(GradeAndWeight_Detail));
update.Where.Conditions.Add(DQCondition.EQ("SID", sid));
update.Columns.Add(new DQUpdateColumn("OrderIndex", orderIdx));
session.ExecuteNonQuery(update);
}
static List<Tuple<int,long>> Get20180411Data(DateTime dateTime,IDmoSession session)
{
var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail)));
query.Columns.Add(DQSelectColumn.Field("Order"));
query.Columns.Add(DQSelectColumn.Field("SID"));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("Order"));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("SID"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Date",dateTime),DQCondition.IsNotNull(DQExpression.Field("Order"))));
var list = new List<Tuple<int,long>>();
using (var reader = session.ExecuteReader(query))
{
while (reader.Read())
{
list.Add(new Tuple<int, long>((int)reader[0], (long)reader[1]));
}
}
return list;
}
} }
} }

+ 226
- 215
WeighAndGrading/GradeFrom.Designer.cs View File

@ -31,16 +31,16 @@
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = 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 dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = 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 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 dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = 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 dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = 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();
@ -52,25 +52,29 @@
this.ttPanel = new System.Windows.Forms.FlowLayoutPanel(); this.ttPanel = new System.Windows.Forms.FlowLayoutPanel();
this.lblTangTui = new System.Windows.Forms.Label(); this.lblTangTui = new System.Windows.Forms.Label();
this.tangGridView = new BWP.WinFormControl.UDataGridView(); 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_WeightID = 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.groupBox2 = new System.Windows.Forms.GroupBox();
this.maoScrollBar = new System.Windows.Forms.VScrollBar(); this.maoScrollBar = new System.Windows.Forms.VScrollBar();
this.maoGridView = new BWP.WinFormControl.UDataGridView(); 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_WeightID = 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.mbPanel = new System.Windows.Forms.FlowLayoutPanel(); this.mbPanel = new System.Windows.Forms.FlowLayoutPanel();
this.lblMaoBo = new System.Windows.Forms.Label(); this.lblMaoBo = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.vScrollBar2 = new System.Windows.Forms.VScrollBar(); this.vScrollBar2 = new System.Windows.Forms.VScrollBar();
this.label12 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label();
this.historyGrid = new BWP.WinFormControl.UDataGridView(); this.historyGrid = new BWP.WinFormControl.UDataGridView();
this.H_SID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Livestock_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_IsDrop = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Technics = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Index = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Order = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Technics_Name = 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.isPrintCheckBox = new System.Windows.Forms.CheckBox(); this.isPrintCheckBox = new System.Windows.Forms.CheckBox();
this.printBtn = new System.Windows.Forms.Button(); this.printBtn = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
@ -89,20 +93,17 @@
this.btnStartWeight = new System.Windows.Forms.Button(); this.btnStartWeight = new System.Windows.Forms.Button();
this.btnStopWeight = new System.Windows.Forms.Button(); this.btnStopWeight = new System.Windows.Forms.Button();
this.dataConfirmBtn = new System.Windows.Forms.Button(); this.dataConfirmBtn = new System.Windows.Forms.Button();
this.T_OrderDetail_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.T_Finish = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.T_WeightID = 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.M_OrderDetail_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_Finish = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.M_WeightID = 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.H_SID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Livestock_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_IsDrop = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Technics = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_OrderIndex = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Index = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Order = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Technics_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Livestock_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Time = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.tangGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tangGridView)).BeginInit();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
@ -256,6 +257,65 @@
this.tangGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.tangGridView_CellClick); this.tangGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.tangGridView_CellClick);
this.tangGridView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.tangGridView_CellContentClick); 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_WeightID
//
this.T_WeightID.DataPropertyName = "WeightID";
this.T_WeightID.HeaderText = "磅单号";
this.T_WeightID.Name = "T_WeightID";
this.T_WeightID.ReadOnly = true;
this.T_WeightID.Width = 90;
//
// T_Order
//
this.T_Order.DataPropertyName = "Order";
this.T_Order.HeaderText = "顺序号";
this.T_Order.Name = "T_Order";
this.T_Order.ReadOnly = true;
this.T_Order.Width = 90;
//
// 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 // groupBox2
// //
this.groupBox2.Controls.Add(this.maoScrollBar); this.groupBox2.Controls.Add(this.maoScrollBar);
@ -319,6 +379,65 @@
this.maoGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.maoGridView_CellClick); this.maoGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.maoGridView_CellClick);
this.maoGridView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.maoGridView_CellContentClick); 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_WeightID
//
this.M_WeightID.DataPropertyName = "WeightID";
this.M_WeightID.HeaderText = "磅单号";
this.M_WeightID.Name = "M_WeightID";
this.M_WeightID.ReadOnly = true;
this.M_WeightID.Width = 90;
//
// M_Order
//
this.M_Order.DataPropertyName = "Order";
this.M_Order.HeaderText = "顺序号";
this.M_Order.Name = "M_Order";
this.M_Order.ReadOnly = true;
this.M_Order.Width = 90;
//
// 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;
//
// mbPanel // mbPanel
// //
this.mbPanel.Location = new System.Drawing.Point(505, 35); this.mbPanel.Location = new System.Drawing.Point(505, 35);
@ -388,6 +507,7 @@
this.H_Livestock_ID, this.H_Livestock_ID,
this.H_IsDrop, this.H_IsDrop,
this.H_Technics, this.H_Technics,
this.H_OrderIndex,
this.H_Index, this.H_Index,
this.H_Order, this.H_Order,
this.H_Technics_Name, this.H_Technics_Name,
@ -409,89 +529,6 @@
this.historyGrid.TabIndex = 0; this.historyGrid.TabIndex = 0;
this.historyGrid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.historyGrid_CellClick); this.historyGrid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.historyGrid_CellClick);
// //
// 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_IsDrop
//
this.H_IsDrop.DataPropertyName = "IsDrop";
this.H_IsDrop.HeaderText = "IsDrop";
this.H_IsDrop.Name = "H_IsDrop";
this.H_IsDrop.ReadOnly = true;
this.H_IsDrop.Visible = false;
//
// H_Technics
//
this.H_Technics.DataPropertyName = "Technics";
this.H_Technics.HeaderText = "Technics";
this.H_Technics.Name = "H_Technics";
this.H_Technics.ReadOnly = true;
this.H_Technics.Visible = false;
//
// H_Index
//
this.H_Index.DataPropertyName = "Index";
this.H_Index.HeaderText = "序号";
this.H_Index.Name = "H_Index";
this.H_Index.ReadOnly = true;
this.H_Index.Width = 65;
//
// H_Order
//
this.H_Order.DataPropertyName = "Order";
this.H_Order.HeaderText = "顺序";
this.H_Order.Name = "H_Order";
this.H_Order.ReadOnly = true;
this.H_Order.Width = 65;
//
// H_Technics_Name
//
this.H_Technics_Name.DataPropertyName = "Technics_Name";
this.H_Technics_Name.HeaderText = "工艺";
this.H_Technics_Name.Name = "H_Technics_Name";
this.H_Technics_Name.ReadOnly = true;
this.H_Technics_Name.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 = 110;
//
// 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 = "HH:mm:ss";
dataGridViewCellStyle12.NullValue = null;
this.H_Time.DefaultCellStyle = dataGridViewCellStyle12;
this.H_Time.HeaderText = "时间";
this.H_Time.Name = "H_Time";
this.H_Time.ReadOnly = true;
//
// isPrintCheckBox // isPrintCheckBox
// //
this.isPrintCheckBox.AutoSize = true; this.isPrintCheckBox.AutoSize = true;
@ -690,123 +727,96 @@
this.dataConfirmBtn.UseVisualStyleBackColor = true; this.dataConfirmBtn.UseVisualStyleBackColor = true;
this.dataConfirmBtn.Click += new System.EventHandler(this.dataConfirmBtn_Click); this.dataConfirmBtn.Click += new System.EventHandler(this.dataConfirmBtn_Click);
// //
// 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_WeightID
//
this.T_WeightID.DataPropertyName = "WeightID";
this.T_WeightID.HeaderText = "磅单号";
this.T_WeightID.Name = "T_WeightID";
this.T_WeightID.ReadOnly = true;
this.T_WeightID.Width = 90;
//
// T_Order
// H_SID
// //
this.T_Order.DataPropertyName = "Order";
this.T_Order.HeaderText = "顺序号";
this.T_Order.Name = "T_Order";
this.T_Order.ReadOnly = true;
this.T_Order.Width = 90;
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;
// //
// T_Number
// H_Livestock_ID
// //
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;
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;
// //
// T_Already
// H_IsDrop
// //
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;
this.H_IsDrop.DataPropertyName = "IsDrop";
this.H_IsDrop.HeaderText = "IsDrop";
this.H_IsDrop.Name = "H_IsDrop";
this.H_IsDrop.ReadOnly = true;
this.H_IsDrop.Visible = false;
// //
// T_FinishBtn
// H_Technics
// //
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;
this.H_Technics.DataPropertyName = "Technics";
this.H_Technics.HeaderText = "Technics";
this.H_Technics.Name = "H_Technics";
this.H_Technics.ReadOnly = true;
this.H_Technics.Visible = false;
// //
// M_OrderDetail_ID
// H_OrderIndex
// //
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;
this.H_OrderIndex.DataPropertyName = "OrderIndex";
this.H_OrderIndex.HeaderText = "OrderIndex";
this.H_OrderIndex.Name = "H_OrderIndex";
this.H_OrderIndex.ReadOnly = true;
this.H_OrderIndex.Visible = false;
// //
// M_Finish
// H_Index
// //
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;
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;
// //
// M_WeightID
// H_Order
// //
this.M_WeightID.DataPropertyName = "WeightID";
this.M_WeightID.HeaderText = "磅单号";
this.M_WeightID.Name = "M_WeightID";
this.M_WeightID.ReadOnly = true;
this.M_WeightID.Width = 90;
this.H_Order.DataPropertyName = "Order";
this.H_Order.HeaderText = "顺序";
this.H_Order.Name = "H_Order";
this.H_Order.ReadOnly = true;
this.H_Order.Width = 65;
// //
// M_Order
// H_Technics_Name
// //
this.M_Order.DataPropertyName = "Order";
this.M_Order.HeaderText = "顺序号";
this.M_Order.Name = "M_Order";
this.M_Order.ReadOnly = true;
this.M_Order.Width = 90;
this.H_Technics_Name.DataPropertyName = "Technics_Name";
this.H_Technics_Name.HeaderText = "工艺";
this.H_Technics_Name.Name = "H_Technics_Name";
this.H_Technics_Name.ReadOnly = true;
this.H_Technics_Name.Width = 65;
// //
// M_Number
// H_Livestock_Name
// //
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;
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 = 110;
// //
// M_Already
// H_Weight
// //
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;
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;
// //
// M_FinishBtn
// H_Time
// //
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;
this.H_Time.DataPropertyName = "Time";
dataGridViewCellStyle12.Format = "HH:mm:ss";
dataGridViewCellStyle12.NullValue = null;
this.H_Time.DefaultCellStyle = dataGridViewCellStyle12;
this.H_Time.HeaderText = "时间";
this.H_Time.Name = "H_Time";
this.H_Time.ReadOnly = true;
// //
// GradeFrom // GradeFrom
// //
@ -902,16 +912,6 @@
private System.Windows.Forms.Button btnStartWeight; private System.Windows.Forms.Button btnStartWeight;
private System.Windows.Forms.Button btnStopWeight; private System.Windows.Forms.Button btnStopWeight;
private System.Windows.Forms.Button dataConfirmBtn; private System.Windows.Forms.Button dataConfirmBtn;
private System.Windows.Forms.DataGridViewTextBoxColumn H_SID;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn H_IsDrop;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Technics;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Index;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Order;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Technics_Name;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_Name;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Time;
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;
private System.Windows.Forms.DataGridViewTextBoxColumn T_WeightID; private System.Windows.Forms.DataGridViewTextBoxColumn T_WeightID;
@ -926,5 +926,16 @@
private System.Windows.Forms.DataGridViewTextBoxColumn M_Number; private System.Windows.Forms.DataGridViewTextBoxColumn M_Number;
private System.Windows.Forms.DataGridViewTextBoxColumn M_Already; private System.Windows.Forms.DataGridViewTextBoxColumn M_Already;
private System.Windows.Forms.DataGridViewButtonColumn M_FinishBtn; private System.Windows.Forms.DataGridViewButtonColumn M_FinishBtn;
private System.Windows.Forms.DataGridViewTextBoxColumn H_SID;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn H_IsDrop;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Technics;
private System.Windows.Forms.DataGridViewTextBoxColumn H_OrderIndex;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Index;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Order;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Technics_Name;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_Name;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Time;
} }
} }

+ 22
- 6
WeighAndGrading/GradeFrom.cs View File

@ -57,6 +57,7 @@ namespace WeighAndGrading
readonly ConcurrentQueue<GradeAndWeight_Detail> noLivestockList; readonly ConcurrentQueue<GradeAndWeight_Detail> noLivestockList;
bool onWorking = false; bool onWorking = false;
Dictionary<int, int> orderMaxIdx;
Thread syncTangGrid, syncMaoGrid, syncDetailGrid; Thread syncTangGrid, syncMaoGrid, syncDetailGrid;
Thread syncToServer; Thread syncToServer;
#region weightNeed #region weightNeed
@ -117,7 +118,7 @@ namespace WeighAndGrading
var tech = livestockTag.Item3 == TANG_TECH ? "烫褪" : "毛剥"; var tech = livestockTag.Item3 == TANG_TECH ? "烫褪" : "毛剥";
if (modifyDetail == null) if (modifyDetail == null)
{
{
AddDetail(livestockTag); AddDetail(livestockTag);
} }
else else
@ -221,6 +222,9 @@ namespace WeighAndGrading
private void syncBtn_Click(object sender, EventArgs e) private void syncBtn_Click(object sender, EventArgs e)
{ {
if (butcherTimeInput.Date.Value == new DateTime(2018, 3, 15))
LocalGradeAndWeightBL.UpdateHistory(butcherTimeInput.Date.Value);
orderMaxIdx = LocalGradeAndWeightBL.GetOrderIdx(butcherTimeInput.Date.Value);
details = LocalGradeAndWeightBL.GetDetails(butcherTimeInput.Date.Value, 50); details = LocalGradeAndWeightBL.GetDetails(butcherTimeInput.Date.Value, 50);
ResetQueue(); ResetQueue();
if (details.Any()) if (details.Any())
@ -424,7 +428,7 @@ namespace WeighAndGrading
{ {
return; return;
} }
var entity = WeightGradePrint.CreatePrintEntity(butcherTimeInput.Date.Value,modifyDetail);
var entity = WeightGradePrint.CreatePrintEntity(butcherTimeInput.Date.Value, modifyDetail);
if (isPrintCheckBox.Checked) if (isPrintCheckBox.Checked)
{ {
WeightGradePrint.Print(entity); WeightGradePrint.Print(entity);
@ -437,13 +441,13 @@ namespace WeighAndGrading
} }
string StartPrintNewEntity(GradeAndWeight_Detail detail,bool add=false)
string StartPrintNewEntity(GradeAndWeight_Detail detail)
{ {
if (string.IsNullOrWhiteSpace(detail.Technics_Name)) if (string.IsNullOrWhiteSpace(detail.Technics_Name))
{ {
return ""; return "";
} }
var entity = WeightGradePrint.CreatePrintEntity(butcherTimeInput.Date.Value, detail, add);
var entity = WeightGradePrint.CreatePrintEntity(butcherTimeInput.Date.Value, detail);
if (isPrintCheckBox.Checked) if (isPrintCheckBox.Checked)
{ {
WeightGradePrint.Print(entity); WeightGradePrint.Print(entity);
@ -703,6 +707,7 @@ namespace WeighAndGrading
first.OrderDetail_ID = currentRow.OrderDetail_ID; first.OrderDetail_ID = currentRow.OrderDetail_ID;
first.Order = currentRow.Order; first.Order = currentRow.Order;
n = currentRow.Already; n = currentRow.Already;
SetOrderInex(first);
} }
first.Date = butcherTimeInput.Date.Value; first.Date = butcherTimeInput.Date.Value;
first.Livestock_ID = livestock.Item1; first.Livestock_ID = livestock.Item1;
@ -715,9 +720,9 @@ namespace WeighAndGrading
SetBtnUnCheck(disBtn); SetBtnUnCheck(disBtn);
disBtn = null; disBtn = null;
} }
var barCode = StartPrintNewEntity(first, true);
var barCode = StartPrintNewEntity(first);
first.BarCode = barCode; first.BarCode = barCode;
LocalGradeAndWeightBL.Update(first, "OrderDetail_ID", "Order", "Date", "Livestock_ID", "Livestock_Name", "Technics", "Technics_Name", "Weight", "BarCode");
LocalGradeAndWeightBL.Update(first, "OrderDetail_ID", "Order", "OrderIndex", "Date", "Livestock_ID", "Livestock_Name", "Technics", "Technics_Name", "Weight", "BarCode");
var tag = details.FirstOrDefault(x => x.SID == first.SID); var tag = details.FirstOrDefault(x => x.SID == first.SID);
if (first != null) if (first != null)
{ {
@ -742,6 +747,7 @@ namespace WeighAndGrading
entity.OrderDetail_ID = currentRow.OrderDetail_ID; entity.OrderDetail_ID = currentRow.OrderDetail_ID;
entity.Order = currentRow.Order; entity.Order = currentRow.Order;
n = currentRow.Already; n = currentRow.Already;
SetOrderInex(entity);
} }
entity.Date = butcherTimeInput.Date.Value; entity.Date = butcherTimeInput.Date.Value;
entity.Livestock_ID = livestock.Item1; entity.Livestock_ID = livestock.Item1;
@ -781,6 +787,16 @@ namespace WeighAndGrading
} }
} }
private void SetOrderInex(GradeAndWeight_Detail detail)
{
if (detail.Order == null)
return;
if (!orderMaxIdx.ContainsKey(detail.Order.Value))
orderMaxIdx.Add(detail.Order.Value, 0);
orderMaxIdx[detail.Order.Value] += 1;
detail.OrderIndex = orderMaxIdx[detail.Order.Value];
}
void SetlblSucessVisibleFalse() void SetlblSucessVisibleFalse()
{ {
this.Invoke(new InvokeHandler(delegate this.Invoke(new InvokeHandler(delegate


+ 3
- 0
WeighAndGrading/GradeFrom.resx View File

@ -171,6 +171,9 @@
<metadata name="H_Technics.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="H_Technics.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="H_OrderIndex.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="H_Index.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="H_Index.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>


+ 5
- 5
WeighAndGrading/WeightGradePrint.cs View File

@ -12,7 +12,7 @@ namespace WeighAndGrading
{ {
public static class WeightGradePrint public static class WeightGradePrint
{ {
public static PrintEntity CreatePrintEntity(DateTime date, GradeAndWeight_Detail detail, bool add = false)
public static PrintEntity CreatePrintEntity(DateTime date, GradeAndWeight_Detail detail)
{ {
string goodsName; string goodsName;
if (detail.Technics_Name == "烫褪") if (detail.Technics_Name == "烫褪")
@ -33,10 +33,10 @@ namespace WeighAndGrading
entity.TelNumber = "0532-88488888"; entity.TelNumber = "0532-88488888";
if (string.IsNullOrWhiteSpace(detail.BarCode)) if (string.IsNullOrWhiteSpace(detail.BarCode))
{ {
int order = LocalGradeAndWeightBL.GetOrderIndex(date, detail);
if (add)
order += 1;
entity.BarCode = string.Format("260912011{0:yyyyMMdd}{1:000}{2:000}", entity.Date, detail.Order, order);
// int order = LocalGradeAndWeightBL.GetOrderIndex(date, detail);
// if (add)
// order += 1;
entity.BarCode = string.Format("260912011{0:yyyyMMdd}{1:000}{2:000}", entity.Date, detail.Order, detail.OrderIndex);
} }
else else
{ {


Loading…
Cancel
Save