屠宰场客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.4 KiB

using BO.Utils;
using ButcherManageClient;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace QualityAndOrder
{
public partial class QualityOrderForm : Form, IAfterLogin
{
#region IAfterLogin
public string RoleName
{
get { return "_1"; }
}
public Form Generate()
{
return this;
}
#endregion
List<Tuple<string, string>> hogGradeList;
List<Tuple<string, string>> houseList;
List<Tuple<long, long, string>> sanctionList;
public QualityOrderForm()
{
InitializeComponent();
hogGradeList = BaseInfoRpcUtil.GetBaseInfoEntity("GetHogGradeList");
houseList = BaseInfoRpcUtil.GetBaseInfoEntity("GetLiveColonyHouseList");
sanctionList = BaseInfoRpcUtil.GetSanctionList();
AddKeyPad();
AddHogGradeBtn();
AddHouseBtn();
}
private void AddKeyPad()
{
for (var i = 1; i < 10; i++)
{
var btn = new Button() { Name = "_" + i, Text = i.ToString(), Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
btn.Click += (sender, e) =>
{
numberBox.Text += btn.Text;
};
keyBoardPanel.Controls.Add(btn);
}
var zero = new Button() { Name = "_0", Text = "0", Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
zero.Click += (sender, e) =>
{
if (!string.IsNullOrEmpty(numberBox.Text))
numberBox.Text += "0";
};
keyBoardPanel.Controls.Add(zero);
var back = new Button() { Name = "_back", Text = "←", Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
back.Click += (sender, e) =>
{
if (!string.IsNullOrEmpty(numberBox.Text))
numberBox.Text = numberBox.Text.Substring(0, numberBox.Text.Length - 1);
};
keyBoardPanel.Controls.Add(back);
var clear = new Button() { Name = "_clear", Text = "清空", Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
clear.Click += (sender, e) =>
{
numberBox.Text = null;
};
keyBoardPanel.Controls.Add(clear);
}
private void AddHogGradeBtn()
{
foreach (var item in hogGradeList)
{
var btn = new Button() { Name = "_" + item.Item1, Tag = item.Item1, Text = item.Item2, Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { Left = 20,Top=5 }, Font = new Font("宋体", 15) };
btn.Click += (sender, e) =>
{
numberBox.Text = btn.Tag.ToString();
};
hogGradePanel.Controls.Add(btn);
}
}
private void AddHouseBtn()
{
foreach (var item in houseList)
{
var btn = new Button() { Name = "_" + item.Item1, Tag = item.Item1, Text = item.Item2, Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
btn.Click += (sender, e) =>
{
numberBox.Text = btn.Tag.ToString();
};
housePanel.Controls.Add(btn);
}
}
}
}