Browse Source

修改。

master
yibo 8 years ago
parent
commit
fc4aec84ba
10 changed files with 551 additions and 119 deletions
  1. +3
    -0
      BO/BO.csproj
  2. +22
    -0
      BO/BO/Bill/SecondOrder/SecondOrder.cs
  3. +19
    -0
      BO/BO/Bill/SecondOrder/SecondOrder_Detail.cs
  4. +56
    -0
      BO/Utils/BillRpc/SecondOrderRpc.cs
  5. +142
    -35
      ButcherOrder/ButcherOrderForm.Designer.cs
  6. +93
    -14
      ButcherOrder/ButcherOrderForm.cs
  7. +24
    -0
      ButcherOrder/ButcherOrderForm.resx
  8. +135
    -68
      ButcherOrder/ViewDetail.Designer.cs
  9. +42
    -2
      ButcherOrder/ViewDetail.cs
  10. +15
    -0
      ButcherOrder/ViewDetail.resx

+ 3
- 0
BO/BO.csproj View File

@ -55,9 +55,12 @@
<ItemGroup>
<Compile Include="BO\Bill\OrderDetail\NeedOrderEntity.cs" />
<Compile Include="BO\Bill\OrderDetail\OrderDetail.cs" />
<Compile Include="BO\Bill\SecondOrder\SecondOrder.cs" />
<Compile Include="BO\Bill\SecondOrder\SecondOrder_Detail.cs" />
<Compile Include="CTuple.cs" />
<Compile Include="Utils\AfterLoginUtil.cs" />
<Compile Include="Utils\BillRpc\OrderDetailRpc.cs" />
<Compile Include="Utils\BillRpc\SecondOrderRpc.cs" />
<Compile Include="Utils\ButcherAppContext.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill_Detail.cs" />


+ 22
- 0
BO/BO/Bill/SecondOrder/SecondOrder.cs View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BO.BO.Bill
{
public class SecondOrder
{
public long ID { get; set; }
public long OrderDetail_ID { get; set; }
public int? Order { get; set; }
public new int? PlanNumber { get; set; }
public int HotFadeNumber { get; set; }
public bool IsOk { get; set; }
}
}

+ 19
- 0
BO/BO/Bill/SecondOrder/SecondOrder_Detail.cs View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BO.BO.Bill
{
public class SecondOrder_Detail
{
public long ID { get; set; }
public long SecondOrder_ID { get; set; }
public int Number { get; set; }
public DateTime Time { get; set; }
}
}

+ 56
- 0
BO/Utils/BillRpc/SecondOrderRpc.cs View File

@ -0,0 +1,56 @@
using BO.BO.Bill;
using Forks.JsonRpc.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Script.Serialization;
namespace BO.Utils.BillRpc
{
public static class SecondOrderRpc
{
static JavaScriptSerializer serializer = new JavaScriptSerializer();
public static List<SecondOrder> GetSecondOrderList(DateTime date)
{
const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/SecondOrderRpc/SyncSecondOrder";
var result = RpcFacade.Call<string>(method, date);
return serializer.Deserialize<List<SecondOrder>>(result);
}
public static void Insert(SecondOrder_Detail detail, SecondOrder order)
{
const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/SecondOrderRpc/InsertDetail";
var dJson = serializer.Serialize(detail);
string mJson = string.Empty;
if (detail.SecondOrder_ID == 0)
mJson = serializer.Serialize(order);
order.ID = RpcFacade.Call<long>(method, dJson, mJson);
}
public static void DetailDetail(SecondOrder_Detail detail)
{
const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/SecondOrderRpc/DetailDetail";
RpcFacade.Call<int>(method, detail.ID, detail.SecondOrder_ID, detail.Number);
}
public static void SetOk(long id, SecondOrder order)
{
const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/SecondOrderRpc/SetOk";
string mJson = string.Empty;
if (id == 0)
mJson = serializer.Serialize(order);
var r = RpcFacade.Call<long>(method, id, mJson);
if (id == 0)
order.ID = r;
}
public static List<SecondOrder_Detail> GetSecondOrderDetails(long id)
{
const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/SecondOrderRpc/GetSecondOrderDetails";
var result = RpcFacade.Call<string>(method, id);
return serializer.Deserialize<List<SecondOrder_Detail>>(result);
}
}
}

+ 142
- 35
ButcherOrder/ButcherOrderForm.Designer.cs View File

@ -28,19 +28,29 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
this.label1 = new System.Windows.Forms.Label();
this.syncBtn = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.orderLabel = new System.Windows.Forms.Label();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.existBtn = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.numberInput = new System.Windows.Forms.TextBox();
this.keyPanel = new System.Windows.Forms.FlowLayoutPanel();
this.okBtn = new System.Windows.Forms.Button();
this.updateBtn = new System.Windows.Forms.Button();
this.uDatePicker1 = new BWP.WinFormControl.UDatePicker();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.secondOrderGridView = new BWP.WinFormControl.UDataGridView();
this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.OrderDetail_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.IsOk = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Ordre = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PlanNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.HotFadeNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.updateBtn = new System.Windows.Forms.DataGridViewButtonColumn();
this.viewBtn = new System.Windows.Forms.DataGridViewButtonColumn();
((System.ComponentModel.ISupportInitialize)(this.secondOrderGridView)).BeginInit();
this.SuspendLayout();
//
// label1
@ -84,19 +94,10 @@
this.orderLabel.TabIndex = 4;
this.orderLabel.Text = "0";
//
// dataGridView1
//
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Location = new System.Drawing.Point(30, 91);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.Size = new System.Drawing.Size(595, 569);
this.dataGridView1.TabIndex = 5;
//
// existBtn
//
this.existBtn.Font = new System.Drawing.Font("宋体", 15F);
this.existBtn.Location = new System.Drawing.Point(900, 18);
this.existBtn.Location = new System.Drawing.Point(900, 11);
this.existBtn.Name = "existBtn";
this.existBtn.Size = new System.Drawing.Size(108, 41);
this.existBtn.TabIndex = 6;
@ -108,7 +109,7 @@
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 15F);
this.label3.Location = new System.Drawing.Point(710, 95);
this.label3.Location = new System.Drawing.Point(671, 98);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(109, 20);
this.label3.TabIndex = 7;
@ -117,22 +118,24 @@
// numberInput
//
this.numberInput.Font = new System.Drawing.Font("宋体", 15F);
this.numberInput.Location = new System.Drawing.Point(821, 92);
this.numberInput.Location = new System.Drawing.Point(786, 91);
this.numberInput.Name = "numberInput";
this.numberInput.Size = new System.Drawing.Size(141, 30);
this.numberInput.Size = new System.Drawing.Size(96, 30);
this.numberInput.TabIndex = 8;
//
// keyPanel
//
this.keyPanel.Location = new System.Drawing.Point(719, 150);
this.keyPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.keyPanel.Location = new System.Drawing.Point(675, 145);
this.keyPanel.Name = "keyPanel";
this.keyPanel.Size = new System.Drawing.Size(250, 333);
this.keyPanel.Padding = new System.Windows.Forms.Padding(15);
this.keyPanel.Size = new System.Drawing.Size(333, 430);
this.keyPanel.TabIndex = 9;
//
// okBtn
//
this.okBtn.Font = new System.Drawing.Font("宋体", 15F);
this.okBtn.Location = new System.Drawing.Point(715, 509);
this.okBtn.Location = new System.Drawing.Point(900, 84);
this.okBtn.Name = "okBtn";
this.okBtn.Size = new System.Drawing.Size(108, 41);
this.okBtn.TabIndex = 10;
@ -140,38 +143,135 @@
this.okBtn.UseVisualStyleBackColor = true;
this.okBtn.Click += new System.EventHandler(this.okBtn_Click);
//
// updateBtn
//
this.updateBtn.Font = new System.Drawing.Font("宋体", 15F);
this.updateBtn.Location = new System.Drawing.Point(855, 509);
this.updateBtn.Name = "updateBtn";
this.updateBtn.Size = new System.Drawing.Size(108, 41);
this.updateBtn.TabIndex = 11;
this.updateBtn.Text = "更新";
this.updateBtn.UseVisualStyleBackColor = true;
this.updateBtn.Click += new System.EventHandler(this.updateBtn_Click);
//
// uDatePicker1
//
this.uDatePicker1.BackColor = System.Drawing.Color.White;
this.uDatePicker1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.uDatePicker1.Date = new System.DateTime(2017, 9, 5, 0, 0, 0, 0);
this.uDatePicker1.Font = new System.Drawing.Font("宋体", 15F);
this.uDatePicker1.Location = new System.Drawing.Point(166, 23);
this.uDatePicker1.Name = "uDatePicker1";
this.uDatePicker1.Size = new System.Drawing.Size(150, 30);
this.uDatePicker1.TabIndex = 1;
this.uDatePicker1.Text = "2017/09/05";
this.uDatePicker1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.uDatePicker1.Type = BWP.WinFormControl.DateTimeType.Date;
//
// secondOrderGridView
//
this.secondOrderGridView.AllowUserToAddRows = false;
this.secondOrderGridView.AllowUserToDeleteRows = false;
this.secondOrderGridView.AllowUserToResizeColumns = false;
this.secondOrderGridView.AllowUserToResizeRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.secondOrderGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.secondOrderGridView.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.secondOrderGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.secondOrderGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.secondOrderGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.ID,
this.OrderDetail_ID,
this.IsOk,
this.Ordre,
this.PlanNumber,
this.HotFadeNumber,
this.updateBtn,
this.viewBtn});
this.secondOrderGridView.Location = new System.Drawing.Point(30, 91);
this.secondOrderGridView.MultiSelect = false;
this.secondOrderGridView.Name = "secondOrderGridView";
this.secondOrderGridView.ReadOnly = true;
this.secondOrderGridView.RowHeadersVisible = false;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.secondOrderGridView.RowsDefaultCellStyle = dataGridViewCellStyle3;
this.secondOrderGridView.RowTemplate.Height = 40;
this.secondOrderGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.secondOrderGridView.Size = new System.Drawing.Size(595, 569);
this.secondOrderGridView.TabIndex = 12;
this.secondOrderGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.secondOrderGridView_CellClick);
//
// ID
//
this.ID.DataPropertyName = "ID";
this.ID.HeaderText = "ID";
this.ID.Name = "ID";
this.ID.ReadOnly = true;
this.ID.Visible = false;
//
// OrderDetail_ID
//
this.OrderDetail_ID.DataPropertyName = "OrderDetail_ID";
this.OrderDetail_ID.HeaderText = "OrderDetail_ID";
this.OrderDetail_ID.Name = "OrderDetail_ID";
this.OrderDetail_ID.ReadOnly = true;
this.OrderDetail_ID.Visible = false;
//
// IsOk
//
this.IsOk.DataPropertyName = "IsOk";
this.IsOk.HeaderText = "IsOk";
this.IsOk.Name = "IsOk";
this.IsOk.ReadOnly = true;
this.IsOk.Visible = false;
//
// Ordre
//
this.Ordre.DataPropertyName = "Order";
this.Ordre.HeaderText = "顺序号";
this.Ordre.Name = "Ordre";
this.Ordre.ReadOnly = true;
this.Ordre.Width = 110;
//
// PlanNumber
//
this.PlanNumber.DataPropertyName = "PlanNumber";
this.PlanNumber.HeaderText = "头数";
this.PlanNumber.Name = "PlanNumber";
this.PlanNumber.ReadOnly = true;
//
// HotFadeNumber
//
this.HotFadeNumber.DataPropertyName = "HotFadeNumber";
this.HotFadeNumber.HeaderText = "烫褪";
this.HotFadeNumber.Name = "HotFadeNumber";
this.HotFadeNumber.ReadOnly = true;
//
// updateBtn
//
this.updateBtn.HeaderText = "更新";
this.updateBtn.Name = "updateBtn";
this.updateBtn.ReadOnly = true;
this.updateBtn.Text = "更新";
this.updateBtn.UseColumnTextForButtonValue = true;
this.updateBtn.Width = 130;
//
// viewBtn
//
this.viewBtn.HeaderText = "查看";
this.viewBtn.Name = "viewBtn";
this.viewBtn.ReadOnly = true;
this.viewBtn.Text = "查看";
this.viewBtn.UseColumnTextForButtonValue = true;
this.viewBtn.Width = 130;
//
// ButcherOrderForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1020, 690);
this.Controls.Add(this.updateBtn);
this.Controls.Add(this.secondOrderGridView);
this.Controls.Add(this.okBtn);
this.Controls.Add(this.keyPanel);
this.Controls.Add(this.numberInput);
this.Controls.Add(this.label3);
this.Controls.Add(this.existBtn);
this.Controls.Add(this.dataGridView1);
this.Controls.Add(this.orderLabel);
this.Controls.Add(this.label2);
this.Controls.Add(this.syncBtn);
@ -182,7 +282,7 @@
this.Name = "ButcherOrderForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "屠宰顺序同步";
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.secondOrderGridView)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -195,12 +295,19 @@
private System.Windows.Forms.Button syncBtn;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label orderLabel;
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.Button existBtn;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox numberInput;
private System.Windows.Forms.FlowLayoutPanel keyPanel;
private System.Windows.Forms.Button okBtn;
private System.Windows.Forms.Button updateBtn;
private BWP.WinFormControl.UDataGridView secondOrderGridView;
private System.Windows.Forms.DataGridViewTextBoxColumn ID;
private System.Windows.Forms.DataGridViewTextBoxColumn OrderDetail_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn IsOk;
private System.Windows.Forms.DataGridViewTextBoxColumn Ordre;
private System.Windows.Forms.DataGridViewTextBoxColumn PlanNumber;
private System.Windows.Forms.DataGridViewTextBoxColumn HotFadeNumber;
private System.Windows.Forms.DataGridViewButtonColumn updateBtn;
private System.Windows.Forms.DataGridViewButtonColumn viewBtn;
}
}

+ 93
- 14
ButcherOrder/ButcherOrderForm.cs View File

@ -1,25 +1,22 @@
using BO.Utils;
using BO.BO.Bill;
using BO.Utils;
using BO.Utils.BillRpc;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.Linq;
namespace ButcherOrder
{
public partial class ButcherOrderForm : Form, IAfterLogin
{
public ButcherOrderForm()
{
InitializeComponent();
dataGridView1.AutoGenerateColumns = false;
AddKeyPad();
}
#region IAfterLogin
public string RoleName
{
get
{
return "测试";
return "排宰员";
}
}
@ -29,25 +26,36 @@ namespace ButcherOrder
}
# endregion
List<SecondOrder> orderList;
public ButcherOrderForm()
{
InitializeComponent();
this.uDatePicker1.Date = DateTime.Today;
secondOrderGridView.AutoGenerateColumns = false;
secondOrderGridView.DataSource = null;
AddKeyPad();
}
private void AddKeyPad()
{
for (var i = 1; i < 10; i++)
{
var btn = new Button() { Name = "_" + i, Text = i.ToString(), Size = new Size(60, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
var btn = new Button() { Name = "_" + i, Text = i.ToString(), Size = new Size(70, 70), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 15 }, Font = new Font("宋体", 15) };
btn.Click += (sender, e) =>
{
numberInput.Text += btn.Text;
};
keyPanel.Controls.Add(btn);
}
var zero = new Button() { Name = "_0", Text = "0", Size = new Size(60, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
var zero = new Button() { Name = "_0", Text = "0", Size = new Size(70, 70), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 15 }, Font = new Font("宋体", 15) };
zero.Click += (sender, e) =>
{
if (!string.IsNullOrEmpty(numberInput.Text))
numberInput.Text += "0";
};
keyPanel.Controls.Add(zero);
var back = new Button() { Name = "_back", Text = "←", Size = new Size(60, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
var back = new Button() { Name = "_back", Text = "←", Size = new Size(70, 70), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 15 }, Font = new Font("宋体", 15) };
back.Click += (sender, e) =>
{
if (!string.IsNullOrEmpty(numberInput.Text))
@ -55,7 +63,7 @@ namespace ButcherOrder
};
keyPanel.Controls.Add(back);
var clear = new Button() { Name = "_clear", Text = "清空", Size = new Size(60, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
var clear = new Button() { Name = "_clear", Text = "清空", Size = new Size(70, 70), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 15 }, Font = new Font("宋体", 15) };
clear.Click += (sender, e) =>
{
numberInput.Text = null;
@ -70,17 +78,88 @@ namespace ButcherOrder
private void syncBtn_Click(object sender, EventArgs e)
{
orderList = SecondOrderRpc.GetSecondOrderList(this.uDatePicker1.Date.Value);
BindGrid();
}
void BindGrid()
{
secondOrderGridView.DataSource = orderList.OrderByDescending(x => x.IsOk).OrderBy(x => x.Order).ToList();
foreach (DataGridViewRow row in secondOrderGridView.Rows)
{
if ((bool)row.Cells["IsOk"].Value)
row.DefaultCellStyle.BackColor = Color.YellowGreen;
}
if (secondOrderGridView.CurrentRow != null)
{
var entity = secondOrderGridView.CurrentRow.DataBoundItem as SecondOrder;
if (!entity.IsOk)
orderLabel.Text = entity.Order.ToString();
BindSelectColor(entity);
}
else
orderLabel.Text = "0";
secondOrderGridView.Refresh();
}
private void okBtn_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(numberInput.Text))
return;
if (secondOrderGridView.CurrentRow == null)
throw new Exception("请先同步数据");
var entity = secondOrderGridView.CurrentRow.DataBoundItem as SecondOrder;
if (entity.IsOk)
{
var result = MessageBox.Show("当前行已更新\n确定要继续修改吗?","确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
if (result != DialogResult.OK)
return;
}
var number = int.Parse(numberInput.Text);
if (entity.HotFadeNumber + number > entity.PlanNumber)
throw new Exception("烫褪头数多余总头数,请确认!");
var detail = new SecondOrder_Detail() { Number = number, SecondOrder_ID = entity.ID, Time = DateTime.Now };
entity.HotFadeNumber += detail.Number;
SecondOrderRpc.Insert(detail, entity);
secondOrderGridView.Refresh();
numberInput.Text = string.Empty;
}
private void updateBtn_Click(object sender, EventArgs e)
void BindSelectColor(SecondOrder entity)
{
if (entity.IsOk)
secondOrderGridView.RowsDefaultCellStyle.SelectionBackColor = Color.FromArgb(204, 51, 51);
else
secondOrderGridView.RowsDefaultCellStyle.SelectionBackColor = Color.FromArgb(66, 163, 218);
}
private void secondOrderGridView_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1)
return;
var entity = secondOrderGridView.CurrentRow.DataBoundItem as SecondOrder;
BindSelectColor(entity);
if (e.ColumnIndex < secondOrderGridView.ColumnCount - 2)
return;
if (e.ColumnIndex == secondOrderGridView.ColumnCount - 2)//更新
{
if (entity.IsOk)
return;
entity.IsOk = true;
SecondOrderRpc.SetOk(entity.ID, entity);
BindGrid();
}
else if ((e.ColumnIndex == secondOrderGridView.ColumnCount - 1))//查看
{
var view = new ViewDetail(entity);
if (view.ShowDialog() == DialogResult.OK)
{
secondOrderGridView.Refresh();
}
}
}
}
}

+ 24
- 0
ButcherOrder/ButcherOrderForm.resx View File

@ -117,4 +117,28 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="OrderDetail_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="IsOk.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Ordre.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PlanNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="HotFadeNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="updateBtn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="viewBtn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

+ 135
- 68
ButcherOrder/ViewDetail.Designer.cs View File

@ -28,16 +28,23 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.orderLabel = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.planNumberLabel = new System.Windows.Forms.Label();
this.hotFadeNumberLabel = new System.Windows.Forms.Label();
this.closeBtn = new System.Windows.Forms.Button();
this.deleteBtn = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.detailGridView1 = new BWP.WinFormControl.UDataGridView();
this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SecondOrder_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Time = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.DeleteBtn = new System.Windows.Forms.DataGridViewButtonColumn();
((System.ComponentModel.ISupportInitialize)(this.detailGridView1)).BeginInit();
this.SuspendLayout();
//
// label1
@ -50,15 +57,15 @@
this.label1.TabIndex = 0;
this.label1.Text = "排宰顺序:";
//
// label2
// orderLabel
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 15F);
this.label2.Location = new System.Drawing.Point(153, 30);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(19, 20);
this.label2.TabIndex = 0;
this.label2.Text = "0";
this.orderLabel.AutoSize = true;
this.orderLabel.Font = new System.Drawing.Font("宋体", 15F);
this.orderLabel.Location = new System.Drawing.Point(153, 30);
this.orderLabel.Name = "orderLabel";
this.orderLabel.Size = new System.Drawing.Size(19, 20);
this.orderLabel.TabIndex = 0;
this.orderLabel.Text = "0";
//
// label3
//
@ -80,77 +87,133 @@
this.label4.TabIndex = 0;
this.label4.Text = "合计烫褪:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("宋体", 15F);
this.label5.Location = new System.Drawing.Point(299, 30);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(19, 20);
this.label5.TabIndex = 0;
this.label5.Text = "0";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("宋体", 15F);
this.label6.Location = new System.Drawing.Point(464, 30);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(19, 20);
this.label6.TabIndex = 0;
this.label6.Text = "0";
//
// dataGridView1
//
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Location = new System.Drawing.Point(44, 80);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true;
this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.Size = new System.Drawing.Size(488, 287);
this.dataGridView1.TabIndex = 1;
// planNumberLabel
//
this.planNumberLabel.AutoSize = true;
this.planNumberLabel.Font = new System.Drawing.Font("宋体", 15F);
this.planNumberLabel.Location = new System.Drawing.Point(299, 30);
this.planNumberLabel.Name = "planNumberLabel";
this.planNumberLabel.Size = new System.Drawing.Size(19, 20);
this.planNumberLabel.TabIndex = 0;
this.planNumberLabel.Text = "0";
//
// hotFadeNumberLabel
//
this.hotFadeNumberLabel.AutoSize = true;
this.hotFadeNumberLabel.Font = new System.Drawing.Font("宋体", 15F);
this.hotFadeNumberLabel.Location = new System.Drawing.Point(464, 30);
this.hotFadeNumberLabel.Name = "hotFadeNumberLabel";
this.hotFadeNumberLabel.Size = new System.Drawing.Size(19, 20);
this.hotFadeNumberLabel.TabIndex = 0;
this.hotFadeNumberLabel.Text = "0";
//
// closeBtn
//
this.closeBtn.Font = new System.Drawing.Font("宋体", 15F);
this.closeBtn.Location = new System.Drawing.Point(169, 384);
this.closeBtn.Location = new System.Drawing.Point(241, 386);
this.closeBtn.Name = "closeBtn";
this.closeBtn.Size = new System.Drawing.Size(91, 37);
this.closeBtn.Size = new System.Drawing.Size(108, 41);
this.closeBtn.TabIndex = 2;
this.closeBtn.Text = "关闭";
this.closeBtn.UseVisualStyleBackColor = true;
//
// deleteBtn
//
this.deleteBtn.Font = new System.Drawing.Font("宋体", 15F);
this.deleteBtn.Location = new System.Drawing.Point(313, 384);
this.deleteBtn.Name = "deleteBtn";
this.deleteBtn.Size = new System.Drawing.Size(91, 37);
this.deleteBtn.TabIndex = 3;
this.deleteBtn.Text = "删除";
this.deleteBtn.UseVisualStyleBackColor = true;
this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click);
//
// detailGridView1
//
this.detailGridView1.AllowUserToAddRows = false;
this.detailGridView1.AllowUserToDeleteRows = false;
this.detailGridView1.AllowUserToResizeColumns = false;
this.detailGridView1.AllowUserToResizeRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.detailGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.detailGridView1.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.detailGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.detailGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.detailGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.ID,
this.SecondOrder_ID,
this.Time,
this.Number,
this.DeleteBtn});
this.detailGridView1.Location = new System.Drawing.Point(44, 80);
this.detailGridView1.MultiSelect = false;
this.detailGridView1.Name = "detailGridView1";
this.detailGridView1.ReadOnly = true;
this.detailGridView1.RowHeadersVisible = false;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.detailGridView1.RowsDefaultCellStyle = dataGridViewCellStyle3;
this.detailGridView1.RowTemplate.Height = 40;
this.detailGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.detailGridView1.Size = new System.Drawing.Size(488, 287);
this.detailGridView1.TabIndex = 4;
this.detailGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.detailGridView1_CellClick);
//
// ID
//
this.ID.DataPropertyName = "ID";
this.ID.HeaderText = "ID";
this.ID.Name = "ID";
this.ID.ReadOnly = true;
this.ID.Visible = false;
//
// SecondOrder_ID
//
this.SecondOrder_ID.DataPropertyName = "SecondOrder_ID";
this.SecondOrder_ID.HeaderText = "SecondOrder_ID";
this.SecondOrder_ID.Name = "SecondOrder_ID";
this.SecondOrder_ID.ReadOnly = true;
this.SecondOrder_ID.Visible = false;
//
// Time
//
this.Time.DataPropertyName = "Time";
this.Time.HeaderText = "时间";
this.Time.Name = "Time";
this.Time.ReadOnly = true;
this.Time.Width = 150;
//
// Number
//
this.Number.DataPropertyName = "Number";
this.Number.HeaderText = "头数";
this.Number.Name = "Number";
this.Number.ReadOnly = true;
this.Number.Width = 150;
//
// DeleteBtn
//
this.DeleteBtn.HeaderText = "删除";
this.DeleteBtn.Name = "DeleteBtn";
this.DeleteBtn.ReadOnly = true;
this.DeleteBtn.Text = "删除";
this.DeleteBtn.UseColumnTextForButtonValue = true;
this.DeleteBtn.Width = 160;
//
// ViewDetail
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(576, 436);
this.Controls.Add(this.deleteBtn);
this.Controls.Add(this.detailGridView1);
this.Controls.Add(this.closeBtn);
this.Controls.Add(this.dataGridView1);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.hotFadeNumberLabel);
this.Controls.Add(this.planNumberLabel);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.orderLabel);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "ViewDetail";
this.Text = "查看明细";
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.detailGridView1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -159,13 +222,17 @@
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label orderLabel;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.Label planNumberLabel;
private System.Windows.Forms.Label hotFadeNumberLabel;
private System.Windows.Forms.Button closeBtn;
private System.Windows.Forms.Button deleteBtn;
private BWP.WinFormControl.UDataGridView detailGridView1;
private System.Windows.Forms.DataGridViewTextBoxColumn ID;
private System.Windows.Forms.DataGridViewTextBoxColumn SecondOrder_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn Time;
private System.Windows.Forms.DataGridViewTextBoxColumn Number;
private System.Windows.Forms.DataGridViewButtonColumn DeleteBtn;
}
}

+ 42
- 2
ButcherOrder/ViewDetail.cs View File

@ -1,4 +1,6 @@
using System;
using BO.BO.Bill;
using BO.Utils.BillRpc;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@ -12,9 +14,47 @@ namespace ButcherOrder
{
public partial class ViewDetail : Form
{
public ViewDetail()
List<SecondOrder_Detail> details;
SecondOrder secondOrder;
public ViewDetail(SecondOrder entity)
{
InitializeComponent();
secondOrder = entity;
orderLabel.Text = entity.Order.ToString();
planNumberLabel.Text = entity.PlanNumber.ToString();
hotFadeNumberLabel.Text = entity.HotFadeNumber.ToString();
detailGridView1.AutoGenerateColumns = false;
details = SecondOrderRpc.GetSecondOrderDetails(entity.ID).OrderBy(x => x.ID).ToList();
detailGridView1.DataSource = null;
detailGridView1.DataSource = details;
detailGridView1.Refresh();
}
private void closeBtn_Click(object sender, EventArgs e)
{
if (changed)
DialogResult = DialogResult.OK;
this.Close();
}
static bool changed = false;
private void detailGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1)
return;
if (e.ColumnIndex != detailGridView1.ColumnCount - 1)
return;
var entity = detailGridView1.CurrentRow.DataBoundItem as SecondOrder_Detail;
SecondOrderRpc.DetailDetail(entity);
secondOrder.HotFadeNumber -= entity.Number;
hotFadeNumberLabel.Text = secondOrder.HotFadeNumber.ToString();
details.Remove(entity);
if (!changed)
changed = true;
detailGridView1.DataSource = null;
if (details.Any())
detailGridView1.DataSource = details;
detailGridView1.Refresh();
}
}
}

+ 15
- 0
ButcherOrder/ViewDetail.resx View File

@ -117,4 +117,19 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SecondOrder_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Time.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Number.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="DeleteBtn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

Loading…
Cancel
Save