Browse Source

白条入库支持修改存货。称重记录加合计行。

master
yibo 7 years ago
parent
commit
831727f07e
5 changed files with 270 additions and 171 deletions
  1. +14
    -0
      ButcherFactory.BO/LocalBL/CarcassInStoreBL.cs
  2. +41
    -39
      ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.Designer.cs
  3. +46
    -2
      ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs
  4. +107
    -124
      ButcherFactory.Form/Dialogs/WeightRecordDialog.Designer.cs
  5. +62
    -6
      ButcherFactory.Form/Dialogs/WeightRecordDialog.cs

+ 14
- 0
ButcherFactory.BO/LocalBL/CarcassInStoreBL.cs View File

@ -60,6 +60,20 @@ namespace ButcherFactory.BO.LocalBL
}
}
public static void ChangeGoods(long id, long goodsID)
{
using (var session = DmoSession.New())
{
var update = new DQUpdateDom(typeof(CarcassInStore));
update.Where.Conditions.Add(DQCondition.EQ("ID", id));
update.Columns.Add(new DQUpdateColumn("Goods_ID", goodsID));
update.Columns.Add(new DQUpdateColumn("Sync", false));
update.Columns.Add(new DQUpdateColumn("RowVersion", DQExpression.Add(DQExpression.Field("RowVersion"), DQExpression.Value(1))));
session.ExecuteNonQuery(update);
session.Commit();
}
}
static bool CheckExist(string barCode, IDmoSession session)
{
if (string.IsNullOrEmpty(barCode))


+ 41
- 39
ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.Designer.cs View File

@ -29,16 +29,16 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CarcassInStoreForm));
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = 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 dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = 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 dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.noCodeBtn = new WinFormControl.UButton();
this.noWeightBtn = new WinFormControl.UButton();
@ -310,15 +310,15 @@
this.historyDataGrid.AllowUserToDeleteRows = false;
this.historyDataGrid.AllowUserToResizeColumns = false;
this.historyDataGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle11.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.historyDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.historyDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.historyDataGrid.BackgroundColor = System.Drawing.Color.White;
this.historyDataGrid.BorderStyle = System.Windows.Forms.BorderStyle.None;
dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle12.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle12.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.historyDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.historyDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.historyDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.historyDataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.H_ID,
@ -334,13 +334,15 @@
this.historyDataGrid.Name = "historyDataGrid";
this.historyDataGrid.ReadOnly = true;
this.historyDataGrid.RowHeadersVisible = false;
dataGridViewCellStyle16.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle16.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.historyDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle16;
this.historyDataGrid.RowTemplate.Height = 23;
dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.historyDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle6;
this.historyDataGrid.RowTemplate.Height = 50;
this.historyDataGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.historyDataGrid.Size = new System.Drawing.Size(602, 230);
this.historyDataGrid.TabIndex = 2;
this.historyDataGrid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.historyDataGrid_CellClick);
this.historyDataGrid.RowPrePaint += new System.Windows.Forms.DataGridViewRowPrePaintEventHandler(this.historyDataGrid_RowPrePaint);
//
// H_ID
//
@ -377,8 +379,8 @@
// H_Weight
//
this.H_Weight.DataPropertyName = "Weight";
dataGridViewCellStyle13.Format = "#0.######";
this.H_Weight.DefaultCellStyle = dataGridViewCellStyle13;
dataGridViewCellStyle3.Format = "#0.######";
this.H_Weight.DefaultCellStyle = dataGridViewCellStyle3;
this.H_Weight.HeaderText = "入库重量";
this.H_Weight.Name = "H_Weight";
this.H_Weight.ReadOnly = true;
@ -386,8 +388,8 @@
// H_BeforeWeight
//
this.H_BeforeWeight.DataPropertyName = "BeforeWeight";
dataGridViewCellStyle14.Format = "#0.######";
this.H_BeforeWeight.DefaultCellStyle = dataGridViewCellStyle14;
dataGridViewCellStyle4.Format = "#0.######";
this.H_BeforeWeight.DefaultCellStyle = dataGridViewCellStyle4;
this.H_BeforeWeight.HeaderText = "胴体重量";
this.H_BeforeWeight.Name = "H_BeforeWeight";
this.H_BeforeWeight.ReadOnly = true;
@ -395,8 +397,8 @@
// H_Discont
//
this.H_Discont.DataPropertyName = "Discont";
dataGridViewCellStyle15.Format = "#0.######";
this.H_Discont.DefaultCellStyle = dataGridViewCellStyle15;
dataGridViewCellStyle5.Format = "#0.######";
this.H_Discont.DefaultCellStyle = dataGridViewCellStyle5;
this.H_Discont.HeaderText = "损耗";
this.H_Discont.Name = "H_Discont";
this.H_Discont.ReadOnly = true;
@ -431,15 +433,15 @@
this.needSubmitGrid.AllowUserToDeleteRows = false;
this.needSubmitGrid.AllowUserToResizeColumns = false;
this.needSubmitGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle17.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.needSubmitGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle17;
dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.needSubmitGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7;
this.needSubmitGrid.BackgroundColor = System.Drawing.Color.White;
this.needSubmitGrid.BorderStyle = System.Windows.Forms.BorderStyle.None;
dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle18.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle18.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.needSubmitGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle18;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle8.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.needSubmitGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8;
this.needSubmitGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.needSubmitGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.U_ID,
@ -452,9 +454,9 @@
this.needSubmitGrid.Name = "needSubmitGrid";
this.needSubmitGrid.ReadOnly = true;
this.needSubmitGrid.RowHeadersVisible = false;
dataGridViewCellStyle20.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle20.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.needSubmitGrid.RowsDefaultCellStyle = dataGridViewCellStyle20;
dataGridViewCellStyle10.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle10.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.needSubmitGrid.RowsDefaultCellStyle = dataGridViewCellStyle10;
this.needSubmitGrid.RowTemplate.Height = 23;
this.needSubmitGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.needSubmitGrid.Size = new System.Drawing.Size(602, 202);
@ -487,8 +489,8 @@
// U_Weight
//
this.U_Weight.DataPropertyName = "Weight";
dataGridViewCellStyle19.Format = "#0.######";
this.U_Weight.DefaultCellStyle = dataGridViewCellStyle19;
dataGridViewCellStyle9.Format = "#0.######";
this.U_Weight.DefaultCellStyle = dataGridViewCellStyle9;
this.U_Weight.HeaderText = "重量";
this.U_Weight.Name = "U_Weight";
this.U_Weight.ReadOnly = true;


+ 46
- 2
ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs View File

@ -42,6 +42,7 @@ namespace ButcherFactory.CarcassInStore_
long? batchID;
List<int> errorWeight = new List<int>();
string strErrorWeight = "";
public long? changeID = null;
public CarcassInStoreForm()
{
InitializeComponent();
@ -148,6 +149,11 @@ namespace ButcherFactory.CarcassInStore_
{
lock (_lock)
{
if (changeID.HasValue)
{
ChangeGoods(sender);
return;
}
var last = needSubmitedList.LastOrDefault();
if (last == null)
throw new Exception("列表无记录");
@ -162,8 +168,8 @@ namespace ButcherFactory.CarcassInStore_
needSubmitGrid.Refresh();
historyList.Insert(0, last);
if (historyList.Count > 100)
historyList.RemoveAt(100);
if (historyList.Count > 30)
historyList.RemoveAt(30);
historyDataGrid.FirstDisplayedScrollingRowIndex = 0;
historyDataGrid.Refresh();
@ -177,6 +183,16 @@ namespace ButcherFactory.CarcassInStore_
}
}
void ChangeGoods(object sender)
{
var btn = sender as UButton;
var tag = historyList.First(x => x.ID == changeID.Value);
CarcassInStoreBL.ChangeGoods(changeID.Value, (long)btn.Tag);
tag.Goods_Name = btn.Text;
changeID = null;
historyDataGrid.Refresh();
}
void Insert(decimal weight)
{
lock (_lock)
@ -261,6 +277,34 @@ namespace ButcherFactory.CarcassInStore_
noCode = !noCode;
noCodeBtn.Text = noCode ? "等待插入" : "无 码";
}
private void historyDataGrid_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
{
if (e.RowIndex < 0)
return;
DataGridViewRow dgrSingle = historyDataGrid.Rows[e.RowIndex];
if ((long)dgrSingle.Cells[0].Value == changeID)
{
dgrSingle.DefaultCellStyle.ForeColor = Color.Red;
dgrSingle.DefaultCellStyle.SelectionForeColor = Color.Red;
}
else
{
dgrSingle.DefaultCellStyle.ForeColor = historyDataGrid.DefaultCellStyle.ForeColor;
dgrSingle.DefaultCellStyle.SelectionForeColor = historyDataGrid.DefaultCellStyle.SelectionForeColor;
}
}
private void historyDataGrid_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex < 0)
return;
var v = (long)historyDataGrid.CurrentRow.Cells[0].Value;
if (v == changeID)
changeID = null;
else
changeID = v;
}
}
}

+ 107
- 124
ButcherFactory.Form/Dialogs/WeightRecordDialog.Designer.cs View File

@ -31,18 +31,12 @@
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WeightRecordDialog));
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WeightRecordDialog));
this.uDataGridView1 = new WinFormControl.UDataGridView();
this.addBtn = new WinFormControl.UButton();
this.panel1 = new System.Windows.Forms.Panel();
this.closeBtn = new WinFormControl.UButton();
this.deleteBtn = new WinFormControl.UButton();
this.weightLabel = new WinFormControl.ULabel();
this.rollBackBtn = new WinFormControl.UButton();
this.R_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.R_Selected = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.R_Image = new System.Windows.Forms.DataGridViewImageColumn();
@ -56,6 +50,11 @@
this.R_DiffWeight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.R_Operator = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.R_Time = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.addBtn = new WinFormControl.UButton();
this.panel1 = new System.Windows.Forms.Panel();
this.rollBackBtn = new WinFormControl.UButton();
this.closeBtn = new WinFormControl.UButton();
this.deleteBtn = new WinFormControl.UButton();
((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).BeginInit();
this.panel1.SuspendLayout();
this.SuspendLayout();
@ -108,120 +107,6 @@
this.uDataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.uDataGridView1_CellClick);
this.uDataGridView1.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.uDataGridView1_CellFormatting);
//
// addBtn
//
this.addBtn.AsClicked = false;
this.addBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("addBtn.BackgroundImage")));
this.addBtn.EnableGroup = false;
this.addBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214)))));
this.addBtn.FlatAppearance.BorderSize = 0;
this.addBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.addBtn.Font = new System.Drawing.Font("宋体", 12F);
this.addBtn.ForeColor = System.Drawing.Color.Black;
this.addBtn.Location = new System.Drawing.Point(3, 5);
this.addBtn.Name = "addBtn";
this.addBtn.PlaySound = false;
this.addBtn.SelfControlEnable = false;
this.addBtn.Size = new System.Drawing.Size(117, 43);
this.addBtn.SoundType = WinFormControl.SoundType.Click;
this.addBtn.TabIndex = 1;
this.addBtn.Text = "新增";
this.addBtn.UseVisualStyleBackColor = true;
this.addBtn.WithStataHode = false;
this.addBtn.Click += new System.EventHandler(this.addBtn_Click);
//
// panel1
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.Controls.Add(this.rollBackBtn);
this.panel1.Controls.Add(this.closeBtn);
this.panel1.Controls.Add(this.deleteBtn);
this.panel1.Controls.Add(this.addBtn);
this.panel1.Location = new System.Drawing.Point(185, 468);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(776, 52);
this.panel1.TabIndex = 2;
//
// closeBtn
//
this.closeBtn.AsClicked = false;
this.closeBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("closeBtn.BackgroundImage")));
this.closeBtn.EnableGroup = false;
this.closeBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214)))));
this.closeBtn.FlatAppearance.BorderSize = 0;
this.closeBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.closeBtn.Font = new System.Drawing.Font("宋体", 12F);
this.closeBtn.ForeColor = System.Drawing.Color.Black;
this.closeBtn.Location = new System.Drawing.Point(623, 5);
this.closeBtn.Name = "closeBtn";
this.closeBtn.PlaySound = false;
this.closeBtn.SelfControlEnable = false;
this.closeBtn.Size = new System.Drawing.Size(117, 43);
this.closeBtn.SoundType = WinFormControl.SoundType.Click;
this.closeBtn.TabIndex = 3;
this.closeBtn.Text = "关闭";
this.closeBtn.UseVisualStyleBackColor = true;
this.closeBtn.WithStataHode = false;
this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click);
//
// deleteBtn
//
this.deleteBtn.AsClicked = false;
this.deleteBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("deleteBtn.BackgroundImage")));
this.deleteBtn.EnableGroup = false;
this.deleteBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214)))));
this.deleteBtn.FlatAppearance.BorderSize = 0;
this.deleteBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.deleteBtn.Font = new System.Drawing.Font("宋体", 12F);
this.deleteBtn.ForeColor = System.Drawing.Color.Black;
this.deleteBtn.Location = new System.Drawing.Point(204, 5);
this.deleteBtn.Name = "deleteBtn";
this.deleteBtn.PlaySound = false;
this.deleteBtn.SelfControlEnable = false;
this.deleteBtn.Size = new System.Drawing.Size(117, 43);
this.deleteBtn.SoundType = WinFormControl.SoundType.Click;
this.deleteBtn.TabIndex = 2;
this.deleteBtn.Text = "删除且更新";
this.deleteBtn.UseVisualStyleBackColor = true;
this.deleteBtn.WithStataHode = false;
this.deleteBtn.Click += new System.EventHandler(this.deleteBtn_Click);
//
// weightLabel
//
this.weightLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.weightLabel.AutoSize = true;
this.weightLabel.BackColor = System.Drawing.Color.Transparent;
this.weightLabel.Font = new System.Drawing.Font("宋体", 15F);
this.weightLabel.ForeColor = System.Drawing.Color.Red;
this.weightLabel.Location = new System.Drawing.Point(18, 483);
this.weightLabel.Name = "weightLabel";
this.weightLabel.Size = new System.Drawing.Size(79, 20);
this.weightLabel.TabIndex = 3;
this.weightLabel.Text = "uLabel1";
//
// rollBackBtn
//
this.rollBackBtn.AsClicked = false;
this.rollBackBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("rollBackBtn.BackgroundImage")));
this.rollBackBtn.EnableGroup = false;
this.rollBackBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214)))));
this.rollBackBtn.FlatAppearance.BorderSize = 0;
this.rollBackBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.rollBackBtn.Font = new System.Drawing.Font("宋体", 12F);
this.rollBackBtn.ForeColor = System.Drawing.Color.Black;
this.rollBackBtn.Location = new System.Drawing.Point(414, 5);
this.rollBackBtn.Name = "rollBackBtn";
this.rollBackBtn.PlaySound = false;
this.rollBackBtn.SelfControlEnable = false;
this.rollBackBtn.Size = new System.Drawing.Size(117, 43);
this.rollBackBtn.SoundType = WinFormControl.SoundType.Click;
this.rollBackBtn.TabIndex = 4;
this.rollBackBtn.Text = "退回";
this.rollBackBtn.UseVisualStyleBackColor = true;
this.rollBackBtn.WithStataHode = false;
this.rollBackBtn.Click += new System.EventHandler(this.rollBackBtn_Click);
//
// R_ID
//
this.R_ID.DataPropertyName = "ID";
@ -333,13 +218,113 @@
this.R_Time.ReadOnly = true;
this.R_Time.Width = 120;
//
// addBtn
//
this.addBtn.AsClicked = false;
this.addBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("addBtn.BackgroundImage")));
this.addBtn.EnableGroup = false;
this.addBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214)))));
this.addBtn.FlatAppearance.BorderSize = 0;
this.addBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.addBtn.Font = new System.Drawing.Font("宋体", 12F);
this.addBtn.ForeColor = System.Drawing.Color.Black;
this.addBtn.Location = new System.Drawing.Point(3, 5);
this.addBtn.Name = "addBtn";
this.addBtn.PlaySound = false;
this.addBtn.SelfControlEnable = false;
this.addBtn.Size = new System.Drawing.Size(117, 43);
this.addBtn.SoundType = WinFormControl.SoundType.Click;
this.addBtn.TabIndex = 1;
this.addBtn.Text = "新增";
this.addBtn.UseVisualStyleBackColor = true;
this.addBtn.WithStataHode = false;
this.addBtn.Click += new System.EventHandler(this.addBtn_Click);
//
// panel1
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.Controls.Add(this.rollBackBtn);
this.panel1.Controls.Add(this.closeBtn);
this.panel1.Controls.Add(this.deleteBtn);
this.panel1.Controls.Add(this.addBtn);
this.panel1.Location = new System.Drawing.Point(185, 468);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(776, 52);
this.panel1.TabIndex = 2;
//
// rollBackBtn
//
this.rollBackBtn.AsClicked = false;
this.rollBackBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("rollBackBtn.BackgroundImage")));
this.rollBackBtn.EnableGroup = false;
this.rollBackBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214)))));
this.rollBackBtn.FlatAppearance.BorderSize = 0;
this.rollBackBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.rollBackBtn.Font = new System.Drawing.Font("宋体", 12F);
this.rollBackBtn.ForeColor = System.Drawing.Color.Black;
this.rollBackBtn.Location = new System.Drawing.Point(414, 5);
this.rollBackBtn.Name = "rollBackBtn";
this.rollBackBtn.PlaySound = false;
this.rollBackBtn.SelfControlEnable = false;
this.rollBackBtn.Size = new System.Drawing.Size(117, 43);
this.rollBackBtn.SoundType = WinFormControl.SoundType.Click;
this.rollBackBtn.TabIndex = 4;
this.rollBackBtn.Text = "退回";
this.rollBackBtn.UseVisualStyleBackColor = true;
this.rollBackBtn.WithStataHode = false;
this.rollBackBtn.Click += new System.EventHandler(this.rollBackBtn_Click);
//
// closeBtn
//
this.closeBtn.AsClicked = false;
this.closeBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("closeBtn.BackgroundImage")));
this.closeBtn.EnableGroup = false;
this.closeBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214)))));
this.closeBtn.FlatAppearance.BorderSize = 0;
this.closeBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.closeBtn.Font = new System.Drawing.Font("宋体", 12F);
this.closeBtn.ForeColor = System.Drawing.Color.Black;
this.closeBtn.Location = new System.Drawing.Point(623, 5);
this.closeBtn.Name = "closeBtn";
this.closeBtn.PlaySound = false;
this.closeBtn.SelfControlEnable = false;
this.closeBtn.Size = new System.Drawing.Size(117, 43);
this.closeBtn.SoundType = WinFormControl.SoundType.Click;
this.closeBtn.TabIndex = 3;
this.closeBtn.Text = "关闭";
this.closeBtn.UseVisualStyleBackColor = true;
this.closeBtn.WithStataHode = false;
this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click);
//
// deleteBtn
//
this.deleteBtn.AsClicked = false;
this.deleteBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("deleteBtn.BackgroundImage")));
this.deleteBtn.EnableGroup = false;
this.deleteBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214)))));
this.deleteBtn.FlatAppearance.BorderSize = 0;
this.deleteBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.deleteBtn.Font = new System.Drawing.Font("宋体", 12F);
this.deleteBtn.ForeColor = System.Drawing.Color.Black;
this.deleteBtn.Location = new System.Drawing.Point(204, 5);
this.deleteBtn.Name = "deleteBtn";
this.deleteBtn.PlaySound = false;
this.deleteBtn.SelfControlEnable = false;
this.deleteBtn.Size = new System.Drawing.Size(117, 43);
this.deleteBtn.SoundType = WinFormControl.SoundType.Click;
this.deleteBtn.TabIndex = 2;
this.deleteBtn.Text = "删除且更新";
this.deleteBtn.UseVisualStyleBackColor = true;
this.deleteBtn.WithStataHode = false;
this.deleteBtn.Click += new System.EventHandler(this.deleteBtn_Click);
//
// WeightRecordDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1069, 528);
this.Controls.Add(this.weightLabel);
this.Controls.Add(this.panel1);
this.Controls.Add(this.uDataGridView1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
@ -350,7 +335,6 @@
((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).EndInit();
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
@ -361,7 +345,6 @@
private System.Windows.Forms.Panel panel1;
private WinFormControl.UButton deleteBtn;
private WinFormControl.UButton closeBtn;
private WinFormControl.ULabel weightLabel;
private WinFormControl.UButton rollBackBtn;
private System.Windows.Forms.DataGridViewTextBoxColumn R_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn R_Selected;


+ 62
- 6
ButcherFactory.Form/Dialogs/WeightRecordDialog.cs View File

@ -21,7 +21,7 @@ namespace ButcherFactory.Dialogs
long? mBatchID = null;
public bool Changed = false;
public bool rolBack = false;
public WeightRecordDialog(SaleOutStore_Detail detail, bool readOnly,long? batchID)
public WeightRecordDialog(SaleOutStore_Detail detail, bool readOnly, long? batchID)
{
InitializeComponent();
mDetail = detail;
@ -34,19 +34,73 @@ namespace ButcherFactory.Dialogs
}
uDataGridView1.BorderStyle = BorderStyle.FixedSingle;
BindGrid();
uDataGridView1.RowPrePaint += uDataGridView1_RowPrePaint;
uDataGridView1.CellPainting += uDataGridView1_CellPainting;
}
void uDataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
var last = uDataGridView1.Rows.Count - 1;
if (e.RowIndex == last)
{
if (e.ColumnIndex == 2)
{
e.PaintBackground(e.ClipBounds, false);
e.Handled = true;
}
else if (e.ColumnIndex == 3)
{
using (Brush foreColor = new SolidBrush(e.CellStyle.ForeColor))
{
e.PaintBackground(e.ClipBounds, false);
StringFormat drawFormat = new StringFormat();
drawFormat.LineAlignment = StringAlignment.Center;
drawFormat.Alignment = System.Drawing.StringAlignment.Center;
e.Graphics.DrawString("合计", e.CellStyle.Font, foreColor, e.CellBounds, drawFormat);
e.Handled = true;
}
}
}
}
void uDataGridView1_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
{
if (e.RowIndex == uDataGridView1.Rows.Count - 1)
{
var row = uDataGridView1.Rows[e.RowIndex];
row.DefaultCellStyle.SelectionForeColor = Color.Black;
row.DefaultCellStyle.BackColor = Color.Khaki;
row.DefaultCellStyle.SelectionBackColor = Color.Khaki;
}
}
void BindGrid()
{
list = CarcassSaleOutBL.GetWeightRecord(mDetail.ID);
var total = new CarcassSaleOut_Detail();
total.Number = list.Sum(x => x.Number);
total.Weight = list.Sum(x => x.Weight);
total.InStoreWeight = list.Sum(x => x.InStoreWeight ?? 0);
var diff = list.Sum(x => x.DiffWeight ?? 0);
list.Add(total);
uDataGridView1.DataSource = list;
ReBuildTotalRow(diff);
uDataGridView1.Refresh();
weightLabel.Text = string.Format("{0:#0.######} KG", list.Sum(x => x.Weight));
}
private void ReBuildTotalRow(decimal diff)
{
var row = uDataGridView1.Rows[list.Count - 1];
row.Cells["R_DiffWeight"].Value = diff;
row.Cells["R_Time"].Value = null;
}
private void addBtn_Click(object sender, EventArgs e)
{
if (new AddWeightRecord(mDetail,mBatchID).ShowDialog() == DialogResult.OK)
if (new AddWeightRecord(mDetail, mBatchID).ShowDialog() == DialogResult.OK)
{
BindGrid();
Changed = true;
@ -55,9 +109,11 @@ namespace ButcherFactory.Dialogs
private void deleteBtn_Click(object sender, EventArgs e)
{
if(uDataGridView1.CurrentRow==null)
if (uDataGridView1.CurrentRow == null)
return;
var id = (long)uDataGridView1.CurrentRow.Cells[0].Value;
if (id == 0)
return;
var tag = list.First(x => x.ID == id);
CarcassSaleOutBL.DeleteAndUpdate(tag);
BindGrid();
@ -71,7 +127,7 @@ namespace ButcherFactory.Dialogs
private void uDataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.RowIndex < 0 || e.ColumnIndex != 2)
if (e.RowIndex < 0 || e.RowIndex == list.Count - 1 || e.ColumnIndex != 2)
return;
var v = (bool)uDataGridView1.Rows[e.RowIndex].Cells[1].Value;
e.Value = v ? CheckImg : UnCheckImg;
@ -79,7 +135,7 @@ namespace ButcherFactory.Dialogs
private void uDataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex < 0)
if (e.RowIndex < 0 || e.RowIndex == list.Count - 1)
return;
var id = (long)uDataGridView1.CurrentRow.Cells[0].Value;
var first = list.First(x => x.ID == id);


Loading…
Cancel
Save