yibo 7 years ago
parent
commit
c88af13aa1
7 changed files with 1491 additions and 157 deletions
  1. +36
    -0
      OffLineQualityOrderForm/Properties/AssemblyInfo.cs
  2. +727
    -0
      OffLineQualityOrderForm/QualityOrderForm.cs
  3. +267
    -0
      OffLineQualityOrderForm/QualityOrderForm.resx
  4. +375
    -0
      OffLineQualityOrderForm/QualityOrderFormForTab2.cs
  5. +0
    -40
      SegmentationWeight/DropDownSets.cs
  6. +50
    -77
      SegmentationWeight/SegmentationWeightForm.Designer.cs
  7. +36
    -40
      SegmentationWeight/SegmentationWeightForm.cs

+ 36
- 0
OffLineQualityOrderForm/Properties/AssemblyInfo.cs View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("OffLineQualityOrderForm")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OffLineQualityOrderForm")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("f197e464-6165-41f0-93ff-bc044f5c6c3f")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

+ 727
- 0
OffLineQualityOrderForm/QualityOrderForm.cs View File

@ -0,0 +1,727 @@
using BO.BO;
using BO.Utils;
using BO.Utils.BillRpc;
using BWP.WinFormControl;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OffLineQualityAndOrder
{
public partial class QualityOrderForm : Form, IAfterLogin
{
#region IAfterLogin
public string RoleName
{
get { return "验质员"; }
}
public Form Generate()
{
return this;
}
#endregion
private delegate void InvokeHandler();
List<Tuple<string, string>> hogGradeList;
List<HouseSplitEntity> houseList;
List<SanctionSplit3Part> sanctionList;
List<HouseAndSanctionList> weightBills;
HouseAndSanctionEdit Dmo;
Thread syncThread;
readonly Color btnSelectForeColor = Color.FromArgb(255, 255, 255);
readonly Color btnSelectBackColor = Color.FromArgb(66, 163, 218);
Color btnUnSelectForeColor = SystemColors.ControlText;
Color btnUnSelectBackColor = Color.FromArgb(225, 225, 225);
public QualityOrderForm()
{
InitializeComponent();
testTimeInput.Date = DateTime.Today;
this.uTabControl1.Selected += (sender, e) =>
{
this.Text = e.TabPage.Text;
};
sanctionGrid.AutoGenerateColumns = false;
weightBillGrid.AutoGenerateColumns = false;
weightBillGrid.DataSource = null;
hogGradeList = BaseInfoRpcUtil.GetBaseInfoEntity("GetHogGradeList");
houseList = HouseSplitEntity.Init(BaseInfoRpcUtil.GetBaseInfoEntity("GetLiveColonyHouseList"));
sanctionList = SanctionSplit3Part.Init(BaseInfoRpcUtil.GetSanctionList());
AddKeyPadForTab1();
AddHogGradeBtn();
BindSanctionGrid();
AddHouseBtn();
numberBox.LostFocus += (sender, e) => { flag = 1; };
sanctionGrid.GotFocus += (sender, e) => { flag = 2; };
this.FormClosing += delegate
{
if (syncThread != null && syncThread.IsAlive)
syncThread.Abort();
if (orderSyncTask != null && orderSyncTask.IsAlive)
orderSyncTask.Abort();
if (bt2SyncTask != null && bt2SyncTask.IsAlive)
bt2SyncTask.Abort();
if (bt3SyncTask != null && bt3SyncTask.IsAlive)
bt3SyncTask.Abort();
};
Tab2Init();
Tab3Init();
}
HouseAndSanctionList lastFirstSelect;
private void SyncTask()
{
while (true)
{
this.Invoke(new InvokeHandler(delegate()
{
weightBills = HouseAndSanctionRpc.GetHouseAndSanctionList(testTimeInput.Date.Value);
BindWeightBillGrid();
BindNumberLabel();
}));
Thread.Sleep(5000);
}
}
int flag = 1;
List<Button> hogGradeBtn = new List<Button>();
List<Button> houseBtn = new List<Button>();
private void BindWeightBillGrid()
{
weightBillGrid.DataSource = weightBills.OrderBy(x => x.ID).OrderBy(x => x.AlreadyHouse).ToList();
if (lastFirstSelect == null && weightBillGrid.CurrentRow != null)
{
lastFirstSelect = weightBillGrid.CurrentRow.DataBoundItem as HouseAndSanctionList;
if (lastFirstSelect.AlreadyHouse)
{
lastFirstSelect = null;
weightBillGrid.CurrentRow.DefaultCellStyle.BackColor = Color.YellowGreen;
}
}
foreach (DataGridViewRow row in weightBillGrid.Rows)
{
if ((bool)row.Cells["W_AlreadyHouse"].Value)
row.DefaultCellStyle.BackColor = Color.YellowGreen;
if (lastFirstSelect != null && lastFirstSelect.ID == (long)row.Cells["W_ID"].Value)
{
lastFirstSelect = row.DataBoundItem as HouseAndSanctionList;
if (lastFirstSelect.AlreadyHouse)
row.DefaultCellStyle.BackColor = Color.Yellow;
else
row.DefaultCellStyle.BackColor = weightBillGrid.RowsDefaultCellStyle.SelectionBackColor;
}
}
InitScrollBar();
weightBillGrid.ClearSelection();
try
{
if (firstRoll != -1)
weightBillGrid.FirstDisplayedScrollingRowIndex = firstRoll;
}
catch
{
firstRoll = -1;
}
weightBillGrid.Refresh();
}
private void AddKeyPadForTab1()
{
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) =>
{
if (flag == 1)
{
numberBox.Text += btn.Text;
}
else if (flag == 2)
InputSanctionNumber(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 (flag == 1)
{
if (!string.IsNullOrEmpty(numberBox.Text))
numberBox.Text += "0";
}
else if (flag == 2)
InputSanctionNumber("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 (flag == 1)
{
if (!string.IsNullOrEmpty(numberBox.Text))
numberBox.Text = numberBox.Text.Substring(0, numberBox.Text.Length - 1);
}
else if (flag == 2)
InputSanctionNumber("←");
};
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) =>
{
if (flag == 1)
{
numberBox.Text = string.Empty;
}
else if (flag == 2)
InputSanctionNumber("清空");
};
keyBoardPanel.Controls.Add(clear);
}
void InputSanctionNumber(string input)
{
if (sanctionGrid.CurrentCell == null)
throw new Exception("请选择一项异常");
var tag = sanctionGrid.CurrentRow.DataBoundItem as SanctionSplit3Part;
var idx = sanctionGrid.SelectedCells[0].ColumnIndex;
if (idx > 3)
{
if (tag.Sanction_ID3 == 0)
return;
tag.Number3 = GetAfterNumber(tag.Number3, input);
}
else if (idx > 1)
{
if (tag.Sanction_ID2 == 0)
return;
tag.Number2 = GetAfterNumber(tag.Number2, input);
}
else
{
if (tag.Sanction_ID1 == 0)
return;
tag.Number1 = GetAfterNumber(tag.Number1, input);
}
sanctionGrid.Refresh();
}
int? GetAfterNumber(int? oldValue, string input)
{
switch (input)
{
case "0":
if (oldValue.HasValue)
return int.Parse(oldValue + "0");
return null;
case "←":
if (oldValue.HasValue)
{
var s = oldValue.ToString();
s = s.Substring(0, s.Length - 1);
if (string.IsNullOrEmpty(s))
return null;
return int.Parse(s);
}
return null;
case "清空":
return null;
default:
var sn = "";
if (oldValue.HasValue)
sn = oldValue.ToString();
sn += input;
return int.Parse(sn);
}
}
Button currentBtn;
private void AddHogGradeBtn()
{
foreach (var item in hogGradeList)
{
var btn = new Button() { Name = "_" + item.Item1, Tag = item, Text = item.Item2, Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { Left = 20, Top = 5 }, Font = new Font("宋体", 15), BackColor = btnUnSelectBackColor };
btn.Click += (sender, e) =>
{
if (currentBtn != null)
SetBtnUnCheck(currentBtn);
if (currentBtn != btn)
{
currentBtn = btn;
SetBtnChecked(currentBtn);
}
else
currentBtn = null;
};
hogGradeBtn.Add(btn);
hogGradePanel.Controls.Add(btn);
}
}
private void BindSanctionGrid()
{
sanctionGrid.DataSource = sanctionList;
sanctionGrid.Refresh();
}
List<Button> houseSelectedBtn = new List<Button>();
private void AddHouseBtn()
{
int pageSize = 48;
foreach (var houseItems in houseList)
{
var tabPage = new TabPage(houseItems.Part);
tabPage.Name = string.Format("house_{0}", houseItems.Part);
var flowCount = houseItems.Details.Count / 48;
if (houseItems.Details.Count % 48 != 0)
flowCount += 1;
FlowLayoutPanel pageBtnPanel = null;
for (var i = 0; i < flowCount; i++)
{
var houseFlow = new FlowLayoutPanel() { RightToLeft = RightToLeft.No, Name = string.Format("houseFlow_{0}", houseItems.Part), BorderStyle = BorderStyle.FixedSingle };
if (flowCount > 1)
{
if (i == 0)
{
pageBtnPanel = new FlowLayoutPanel() { Dock = DockStyle.Bottom, Height = 65, RightToLeft = RightToLeft.No, BorderStyle = BorderStyle.FixedSingle };
pageBtnPanel.Location = new Point(3, 492 - 65);
}
else
houseFlow.Visible = false;
var btn = new Button() { Text = (i + 1).ToString(), Tag = houseFlow, Size = new Size(75, 55), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 5 }, Font = new Font("宋体", 15) };
pageBtnPanel.Controls.Add(btn);
btn.Click += (sender, e) =>
{
var currentBind = btn.Tag as FlowLayoutPanel;
foreach (var subControl in pageBtnPanel.Controls)
{
var pb = subControl as Button;
var p = pb.Tag as FlowLayoutPanel;
p.Visible = currentBind == p;
}
};
houseFlow.Width = 709;
houseFlow.Height = 492 - 70;
}
else
houseFlow.Dock = DockStyle.Fill;
tabPage.Controls.Add(houseFlow);
if (pageBtnPanel != null)
tabPage.Controls.Add(pageBtnPanel);
int idx = i * pageSize;
for (var j = 0; j < pageSize; j++)
{
var padding = new Padding { All = 5 };
if ((idx + 1) % 8 != 0 && (idx + 1) % 4 == 0)
padding = new Padding(5, 5, 15, 5);
var house = houseItems.Details[idx];
var btn = new Button() { Name = "_" + house.Item1, Tag = house, Text = house.Item2, Size = new Size(77, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = padding, Font = new Font("宋体", 12), BackColor = btnUnSelectBackColor };
btn.Click += (sender, e) =>
{
if (houseSelectedBtn.Contains(btn))
{
btn.BackColor = btnUnSelectBackColor;
btn.ForeColor = btnUnSelectForeColor;
houseSelectedBtn.Remove(btn);
}
else
{
btn.BackColor = btnSelectBackColor;
btn.ForeColor = btnSelectForeColor;
houseSelectedBtn.Add(btn);
}
};
houseBtn.Add(btn);
houseFlow.Controls.Add(btn);
idx += 1;
if (idx == houseItems.Details.Count)
break;
}
}
housePanel.TabPages.Add(tabPage);
}
if (housePanel.TabPages.Count != 0)
housePanel.SelectedIndex = housePanel.TabPages.Count - 1;
}
private void closeBtn_Click(object sender, EventArgs e)
{
this.Close();
}
private void commitBtn_Click(object sender, EventArgs e)
{
GetDataFromUI();
bool multilOrder = HouseAndSanctionRpc.UpdateInsertHouseAndSanction(Dmo);
Dmo = null;
weightBills = HouseAndSanctionRpc.GetHouseAndSanctionList(testTimeInput.Date.Value);
BindWeightBillGrid();
BindNumberLabel();
ResetTab1Controls();
if (multilOrder)
UMessageBox.Show(string.Format("提交完毕!{0} 磅单出现多次排宰", Environment.NewLine), "注意");
else
UMessageBox.Show("提交成功!");
}
private void syncBtn_Click(object sender, EventArgs e)
{
if (syncThread == null || !syncThread.IsAlive)
{
syncThread = new Thread(SyncTask);
syncThread.Start();
syncBtn.BackColor = Color.FromArgb(15, 215, 107);
syncBtn.ForeColor = Color.White;
}
else
{
syncThread.Abort();
syncBtn.BackColor = Color.FromKnownColor(KnownColor.Control);
syncBtn.ForeColor = Color.FromKnownColor(KnownColor.ControlText);
}
//BindNumberLabel();
//tab1SyncThread = new Thread(StartQuery) { IsBackground = true };
//tab1SyncThread.Start();
}
//bool isWork = false;
//private void StartQuery()
//{
// if (isWork)
// return;
// isWork = true;
// while (mainIsRun)
// {
// this.Invoke(new InvokeHandler(delegate()
// {
// weightBills = WeightBillRpc.GetUnHousedBill(testTimeInput.Date.Value);
// BindWeightBillGrid();
// }));
// Thread.Sleep(10000);
// }
//}
void BindNumberLabel()
{
var inHouseNumber = HouseAndSanctionRpc.GetDetailTotalNumber(testTimeInput.Date.Value);
inHouseNumberLabel.Text = string.Format("{0}", inHouseNumber);
}
void GetDataFromUI()
{
if (Dmo == null)
{
if (lastFirstSelect == null)
throw new Exception("请选择需要处理的记录");
Dmo = new HouseAndSanctionEdit();
Dmo.ID = lastFirstSelect.ID;
}
else
{
Dmo.HouseDetails.Clear();
Dmo.SanctionDetails.Clear();
}
if (string.IsNullOrEmpty(numberBox.Text))
throw new Exception("数量不能为空");
//if (currentBtn == null)
//throw new Exception("请选等级");
if (houseSelectedBtn.Count == 0)
throw new Exception("请选择圈舍");
foreach (var btn in houseSelectedBtn)
{
var house = btn.Tag as Tuple<string, string>;
var houseDetail = new WeightBill_HouseDetail() { WeightBill_ID = Dmo.ID, LiveColonyHouse_ID = long.Parse(house.Item1), LiveColonyHouse_Name = house.Item2 };
Dmo.HouseDetails.Add(houseDetail);
houseDetail.Index = Dmo.HouseDetails.Max(x => x.Index) + 1;
}
if (currentBtn != null)
{
var gradeTag = currentBtn.Tag as Tuple<string, string>;
Dmo.HogGrade_ID = long.Parse(gradeTag.Item1);
Dmo.HogGrade_Name = gradeTag.Item2;
}
Dmo.Number = int.Parse(numberBox.Text);
foreach (DataGridViewRow row in sanctionGrid.Rows)
{
var tag = row.DataBoundItem as SanctionSplit3Part;
if( (tag.Number1??0)!=0)
{
var detail = new WeightBill_SanctionDetail();
Dmo.SanctionDetails.Add(detail);
detail.WeightBill_ID = Dmo.ID;
detail.Index = Dmo.SanctionDetails.Max(x => x.Index) + 1;
detail.Sanction_ID = tag.Sanction_ID1;
detail.AbnormalItem_ID = tag.AbnormalItem_ID1;
detail.AbnormalItem_Name = tag.AbnormalItem_Name1;
detail.Number = tag.Number1;
}
if ((tag.Number2 ?? 0) != 0)
{
var detail = new WeightBill_SanctionDetail();
Dmo.SanctionDetails.Add(detail);
detail.WeightBill_ID = Dmo.ID;
detail.Index = Dmo.SanctionDetails.Max(x => x.Index) + 1;
detail.Sanction_ID = tag.Sanction_ID2;
detail.AbnormalItem_ID = tag.AbnormalItem_ID2;
detail.AbnormalItem_Name = tag.AbnormalItem_Name2;
detail.Number = tag.Number2;
}
if ((tag.Number3 ?? 0) != 0)
{
var detail = new WeightBill_SanctionDetail();
Dmo.SanctionDetails.Add(detail);
detail.WeightBill_ID = Dmo.ID;
detail.Index = Dmo.SanctionDetails.Max(x => x.Index) + 1;
detail.Sanction_ID = tag.Sanction_ID3;
detail.AbnormalItem_ID = tag.AbnormalItem_ID3;
detail.AbnormalItem_Name = tag.AbnormalItem_Name3;
detail.Number = tag.Number3;
}
}
}
void ResetTab1Controls()
{
foreach (var item in houseSelectedBtn)
SetBtnUnCheck(item);
houseSelectedBtn.Clear();
if (currentBtn != null)
SetBtnUnCheck(currentBtn);
numberBox.Text = string.Empty;
foreach (var item in sanctionList)
item.Number1 = item.Number2 = item.Number3 = null;
sanctionGrid.Refresh();
uTabControl2.SelectedIndex = 0;
flag = 1;
}
private void weightBillGrid_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex < 0)
return;
if (lastFirstSelect != null)
{
foreach (DataGridViewRow row in weightBillGrid.Rows)
{
if (lastFirstSelect.ID == (long)row.Cells["W_ID"].Value)
{
row.DefaultCellStyle.BackColor = lastFirstSelect.AlreadyHouse ? Color.YellowGreen : weightBillGrid.RowsDefaultCellStyle.BackColor;
break;
}
}
}
lastFirstSelect = weightBillGrid.CurrentRow.DataBoundItem as HouseAndSanctionList;
weightBillGrid.CurrentRow.DefaultCellStyle.SelectionBackColor = lastFirstSelect.AlreadyHouse ? Color.Yellow : weightBillGrid.RowsDefaultCellStyle.SelectionBackColor;
weightBillGrid.Refresh();
ResetTab1Controls();
Tab1AppToUI();
}
void Tab1AppToUI()
{
Dmo = HouseAndSanctionRpc.GetHouseAndSanctionDetail(lastFirstSelect.ID);
numberBox.Text = string.Empty;
if (Dmo.HogGrade_ID.HasValue)
{
var first = hogGradeBtn.FirstOrDefault(x => x.Name == "_" + Dmo.HogGrade_ID);
if (first != null)
{
currentBtn = first;
SetBtnChecked(currentBtn);
}
}
foreach (var item in Dmo.HouseDetails)
{
var first = houseBtn.FirstOrDefault(x => x.Name == "_" + item.LiveColonyHouse_ID);
if (first != null)
{
SetBtnChecked(first);
houseSelectedBtn.Add(first);
}
}
foreach (var item in Dmo.SanctionDetails)
{
var first = sanctionList.FirstOrDefault(x => x.AbnormalItem_ID1 == item.AbnormalItem_ID);
if (first != null)
{
first.Number1 = item.Number;
continue;
}
var second = sanctionList.FirstOrDefault(x => x.AbnormalItem_ID2 == item.AbnormalItem_ID);
if (second != null)
{
second.Number2 = item.Number;
continue;
}
var third = sanctionList.FirstOrDefault(x => x.AbnormalItem_ID3 == item.AbnormalItem_ID);
if (third != null)
{
third.Number3 = item.Number;
continue;
}
}
sanctionGrid.DataSource = sanctionList;
sanctionGrid.Refresh();
}
void SetBtnChecked(Button btn)
{
btn.BackColor = btnSelectBackColor;
btn.ForeColor = btnSelectForeColor;
}
void SetBtnUnCheck(Button btn)
{
btn.BackColor = btnUnSelectBackColor;
btn.ForeColor = btnUnSelectForeColor;
}
int firstRoll = -1;
private void InitScrollBar()
{
vScrollBar1.Maximum = (weightBillGrid.RowCount - weightBillGrid.DisplayedRowCount(false) + 30) * weightBillGrid.RowTemplate.Height;
vScrollBar1.Minimum = 0;
vScrollBar1.SmallChange = weightBillGrid.RowTemplate.Height;
vScrollBar1.LargeChange = weightBillGrid.RowTemplate.Height * 30;
this.vScrollBar1.Scroll += (sender, e) =>
{
firstRoll = e.NewValue / weightBillGrid.RowTemplate.Height;
weightBillGrid.FirstDisplayedScrollingRowIndex = firstRoll;
};
}
}
class SanctionSplit3Part
{
public long Sanction_ID1 { get; set; }
public long AbnormalItem_ID1 { get; set; }
public string AbnormalItem_Name1 { get; set; }
public int? Number1 { get; set; }
public long Sanction_ID2 { get; set; }
public long AbnormalItem_ID2 { get; set; }
public string AbnormalItem_Name2 { get; set; }
public int? Number2 { get; set; }
public long Sanction_ID3 { get; set; }
public long AbnormalItem_ID3 { get; set; }
public string AbnormalItem_Name3 { get; set; }
public int? Number3 { get; set; }
public static List<SanctionSplit3Part> Init(List<Tuple<long, long, string>> list)
{
var result = new List<SanctionSplit3Part>();
var count = list.Count / 3;
if (list.Count % 3 != 0)
count += 1;
for (var i = 0; i < count; i++)
{
var detail = new SanctionSplit3Part();
result.Add(detail);
var idx = i * 3;
var item = list[idx];
detail.Sanction_ID1 = item.Item1;
detail.AbnormalItem_ID1 = item.Item2;
detail.AbnormalItem_Name1 = item.Item3;
idx += 1;
if (idx == list.Count)
break;
item = list[idx];
detail.Sanction_ID2 = item.Item1;
detail.AbnormalItem_ID2 = item.Item2;
detail.AbnormalItem_Name2 = item.Item3;
idx += 1;
if (idx == list.Count)
break;
item = list[idx];
detail.Sanction_ID3 = item.Item1;
detail.AbnormalItem_ID3 = item.Item2;
detail.AbnormalItem_Name3 = item.Item3;
}
return result;
}
public static List<Tuple<long, long, string, int>> ReInit(List<SanctionSplit3Part> list)
{
var result = new List<Tuple<long, long, string, int>>();
foreach (var item in list)
{
if ((item.Number1 ?? 0) != 0)
{
var detail = new Tuple<long, long, string, int>(item.Sanction_ID1, item.AbnormalItem_ID1, item.AbnormalItem_Name1, item.Number1.Value);
result.Add(detail);
}
if (item.Sanction_ID2 == 0)
break;
if ((item.Number2 ?? 0) != 0)
{
var detail = new Tuple<long, long, string, int>(item.Sanction_ID2, item.AbnormalItem_ID2, item.AbnormalItem_Name2, item.Number2.Value);
result.Add(detail);
}
if (item.Sanction_ID3 == 0)
break;
if ((item.Number3 ?? 0) != 0)
{
var detail = new Tuple<long, long, string, int>(item.Sanction_ID3, item.AbnormalItem_ID3, item.AbnormalItem_Name3, item.Number3.Value);
result.Add(detail);
}
}
return result;
}
}
class HouseSplitEntity
{
public string Part { get; set; }
List<Tuple<string, string>> details = new List<Tuple<string, string>>();
public List<Tuple<string, string>> Details { get { return details; } }
public static List<HouseSplitEntity> Init(List<Tuple<string, string>> list)
{
var result = new List<HouseSplitEntity>();
foreach (var item in list)
{
var part = item.Item2[0].ToString();
var first = result.FirstOrDefault(x => x.Part == part);
if (first == null)
{
first = new HouseSplitEntity { Part = part };
result.Add(first);
}
first.Details.Add(new Tuple<string, string>(item.Item1, item.Item2));
}
result.Reverse();
return result;
}
}
}

+ 267
- 0
OffLineQualityOrderForm/QualityOrderForm.resx View File

@ -0,0 +1,267 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="S_AbnormalItem_Name1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="S_Number1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="S_AbnormalItem_Name2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="S_Number2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="S_AbnormalItem_Name3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="S_Number3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="S_Sanction_ID1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="S_AbnormalItem_ID1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="S_Sanction_ID2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="S_AbnormalItem_ID2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="S_Sanction_ID3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="S_AbnormalItem_ID3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="W_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="W_AlreadyHouse.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="W_B3ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="W_Employee_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="W_Supplier_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="W_Number.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="W_HouseNames.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="P_WeightBill_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="P_Show.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="P_B3ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="P_Supplier_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="P_HouseNames.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="P_Number.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="P_AlreadyNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="P_LastNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="P_WeighTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="P_OKBtn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="P_Hidden.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="O_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="O_IsHurryButcher.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="O_WeightBill_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="O_SecondarySplit.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="O_Date.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="O_Order.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="O_B3WeighBill_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="O_Supplier_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="O_LiveColonyHouse_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="O_PlanNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="O_OKBtn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="H_WeightBill_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="H_B3WeighBill_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="H_Supplier_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="H_LiveColonyHouse_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="H_WeightNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="H_HurryNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewButtonColumn1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="H_View.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

+ 375
- 0
OffLineQualityOrderForm/QualityOrderFormForTab2.cs View File

@ -0,0 +1,375 @@
using BO;
using BO.BO.Bill;
using BO.Utils.BillRpc;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace QualityAndOrder
{
partial class QualityOrderForm
{
List<NeedOrderEntity> needOrderList;
List<OrderDetail> orderList;
Thread orderSyncTask;
Thread bt2SyncTask;
void Tab2Init()
{
tab2DateSelect.Date = DateTime.Today;
butcherDateInput.Date = DateTime.Today;
orderGrid.AutoGenerateColumns = false;
preOrderGrid.AutoGenerateColumns = false;
orderGrid.DataSource = null;
preOrderGrid.DataSource = null;
AddKeyPadForTab2();
}
private void AddKeyPadForTab2()
{
for (var i = 1; i < 10; i++)
{
var btn = new Button() { Name = "_2" + 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) =>
{
InputPlanNumber(btn.Text);
};
tab2KeyPanel.Controls.Add(btn);
}
var zero = new Button() { Name = "_20", Text = "0", Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
zero.Click += (sender, e) =>
{
InputPlanNumber(zero.Text);
};
tab2KeyPanel.Controls.Add(zero);
var back = new Button() { Name = "_2back", Text = "←", Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
back.Click += (sender, e) =>
{
InputPlanNumber(back.Text);
};
tab2KeyPanel.Controls.Add(back);
var clear = new Button() { Name = "_2clear", Text = "清空", Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
clear.Click += (sender, e) =>
{
InputPlanNumber(clear.Text);
};
tab2KeyPanel.Controls.Add(clear);
}
void InputPlanNumber(string input)
{
if (lastOrderDetail == null)
throw new Exception("请选择一条排宰明细");
lastOrderDetail.PlanNumber = GetAfterNumber(lastOrderDetail.PlanNumber, input) ?? 0;
orderGrid.Refresh();
}
private void butcherSearch_Click(object sender, EventArgs e)
{
if (orderSyncTask == null || !orderSyncTask.IsAlive)
{
orderSyncTask = new Thread(OrderSearchTask);
orderSyncTask.Start();
butcherSearch.BackColor = Color.FromArgb(15, 215, 107);
butcherSearch.ForeColor = Color.White;
}
else
{
orderSyncTask.Abort();
butcherSearch.BackColor = Color.FromKnownColor(KnownColor.Control);
butcherSearch.ForeColor = Color.FromKnownColor(KnownColor.ControlText);
}
}
private void tab2SyncBtn_Click(object sender, EventArgs e)
{
if (bt2SyncTask == null || !bt2SyncTask.IsAlive)
{
bt2SyncTask = new Thread(Tb2SyncTask);
bt2SyncTask.Start();
tab2SyncBtn.BackColor = Color.FromArgb(15, 215, 107);
tab2SyncBtn.ForeColor = Color.White;
}
else
{
bt2SyncTask.Abort();
tab2SyncBtn.BackColor = Color.FromKnownColor(KnownColor.Control);
tab2SyncBtn.ForeColor = Color.FromKnownColor(KnownColor.ControlText);
}
}
void Tb2SyncTask()
{
while (true)
{
this.Invoke(new InvokeHandler(delegate()
{
BindPreOrderGrid();
}));
Thread.Sleep(5000);
}
}
void OrderSearchTask()
{
while (true)
{
this.Invoke(new InvokeHandler(delegate()
{
BindOrderGrid();
}));
Thread.Sleep(5000);
}
}
NeedOrderEntity lastPreOrder;
void BindPreOrderGrid()
{
needOrderList = OrderDetailRpc.GetNeedOrderWeightBill(tab2DateSelect.Date.Value, GetSelectType());
preOrderGrid.DataSource = needOrderList.OrderBy(x => x.WeighTime).ToList();
foreach (DataGridViewRow row in preOrderGrid.Rows)
{
var show = (bool)row.Cells["P_Show"].Value;
if (!show)
row.DefaultCellStyle.BackColor = Color.YellowGreen;
((DataGridViewButtonCell)row.Cells["P_Hidden"]).Value = show ? "隐藏" : "显示";
if (lastPreOrder != null && lastPreOrder.WeightBill_ID == (long)row.Cells["P_WeightBill_ID"].Value)
{
lastPreOrder = row.DataBoundItem as NeedOrderEntity;
if (lastPreOrder.Show)
row.DefaultCellStyle.BackColor = preOrderGrid.RowsDefaultCellStyle.SelectionBackColor;
else
row.DefaultCellStyle.BackColor = Color.Yellow;
}
}
InitScrollBar3();
preOrderGrid.ClearSelection();
try
{
if (r2Roll != -1)
preOrderGrid.FirstDisplayedScrollingRowIndex = r2Roll;
}
catch
{
r2Roll = -1;
}
preOrderGrid.Refresh();
}
OrderDetail lastOrderDetail;
void BindOrderGrid()
{
orderList = OrderDetailRpc.GetOrderDetail(butcherDateInput.Date.Value);
if (lastOrderDetail != null)
{
var t = orderList.FirstOrDefault(x => x.ID == lastOrderDetail.ID);
if (t != null)
t.PlanNumber = lastOrderDetail.PlanNumber;
}
orderGrid.DataSource = orderList.OrderByDescending(x => x.Order).ToList();
if (lastOrderDetail == null && orderGrid.CurrentRow != null)
{
lastOrderDetail = orderGrid.CurrentRow.DataBoundItem as OrderDetail;
}
foreach (DataGridViewRow row in orderGrid.Rows)
{
if ((bool)row.Cells["O_IsHurryButcher"].Value)
row.DefaultCellStyle.BackColor = ColorTranslator.FromHtml("#CC9999");
if ((bool)row.Cells["O_SecondarySplit"].Value)
row.DefaultCellStyle.BackColor = ColorTranslator.FromHtml("#6699CC");
if (lastOrderDetail != null && lastOrderDetail.ID == (long)row.Cells["O_ID"].Value)
{
lastOrderDetail = row.DataBoundItem as OrderDetail;
var c = orderGrid.RowsDefaultCellStyle.SelectionBackColor;
if (lastOrderDetail.IsHurryButcher)
row.DefaultCellStyle.BackColor = ColorTranslator.FromHtml("#FF9900");
if (lastOrderDetail.SecondarySplit)
row.DefaultCellStyle.BackColor = ColorTranslator.FromHtml("#006699");
row.DefaultCellStyle.BackColor = c;
}
}
InitScrollBar2();
orderGrid.ClearSelection();
try
{
if (r1Roll != -1)
orderGrid.FirstDisplayedScrollingRowIndex = r1Roll;
}
catch
{
r1Roll = -1;
}
orderGrid.Refresh();
}
private void preOrderGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1)
return;
if (e.ColumnIndex < preOrderGrid.ColumnCount - 2)
return;
if (e.ColumnIndex == preOrderGrid.ColumnCount - 2)
{
var currentOrder = 0;
if (lastOrderDetail != null && lastOrderDetail.Date != butcherDateInput.Date)
lastOrderDetail = null;
if (lastOrderDetail != null)
currentOrder = OrderDetailRpc.GetCurrentOrder(lastOrderDetail.ID);
else
currentOrder = OrderDetailRpc.GetMaxOrder(butcherDateInput.Date.Value);
currentOrder++;
var order = new OrderDetail();
order.Order = currentOrder;
order.LiveColonyHouse_Name = lastPreOrder.HouseNames;
order.PlanNumber = lastPreOrder.LastNumber;
order.WeightBill_ID = lastPreOrder.WeightBill_ID;
order.B3WeighBill_ID = lastPreOrder.B3ID;
order.Date = butcherDateInput.Date.Value;
OrderDetailRpc.Insert(order);
lastOrderDetail = order;
BindOrderGrid();
}
else
OrderDetailRpc.ChangeShowType((long)preOrderGrid.CurrentRow.Cells["P_WeightBill_ID"].Value, !(bool)preOrderGrid.CurrentRow.Cells["P_Show"].Value);
BindPreOrderGrid();
}
private void preOrderGrid_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1)
return;
var entity = preOrderGrid.CurrentRow.DataBoundItem as NeedOrderEntity;
if (e.ColumnIndex == preOrderGrid.ColumnCount - 2)//排宰
{
if (lastPreOrder != null)
{
foreach (DataGridViewRow row in preOrderGrid.Rows)
{
if (lastPreOrder.WeightBill_ID == (long)row.Cells["P_WeightBill_ID"].Value)
{
row.DefaultCellStyle.BackColor = lastPreOrder.Show ? preOrderGrid.RowsDefaultCellStyle.BackColor : Color.YellowGreen;
break;
}
}
}
lastPreOrder = entity;
preOrderGrid.CurrentRow.DefaultCellStyle.SelectionBackColor = lastPreOrder.Show ? preOrderGrid.RowsDefaultCellStyle.SelectionBackColor : Color.Yellow;
}
else
{
lastPreOrder = null;
}
preOrderGrid.Refresh();
}
private void orderGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1)
return;
if (e.ColumnIndex != orderGrid.ColumnCount - 1)
return;
if (lastOrderDetail.PlanNumber < 0)
throw new Exception("排宰头数不能小于0");
var lastNumber = OrderDetailRpc.GetLastNumber(lastOrderDetail.WeightBill_ID, lastOrderDetail.ID);
if (lastOrderDetail.PlanNumber > lastNumber)
throw new Exception("排宰总头数多于过磅头数");
var dbCurrentNumber = OrderDetailRpc.GetCurrentOrderPlanNumber(lastOrderDetail.ID);
if (lastOrderDetail.PlanNumber == dbCurrentNumber)
return;
if (lastOrderDetail.PlanNumber == 0)
{
OrderDetailRpc.Delete(lastOrderDetail.ID);
lastOrderDetail = null;
}
else
OrderDetailRpc.UpdateNumber(lastOrderDetail.ID, lastOrderDetail.PlanNumber);
BindPreOrderGrid();
BindOrderGrid();
}
private void orderGrid_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1)
return;
var entity = orderGrid.CurrentRow.DataBoundItem as OrderDetail;
if (lastOrderDetail != null)
{
foreach (DataGridViewRow row in orderGrid.Rows)
{
if (lastOrderDetail.ID == (long)row.Cells["O_ID"].Value)
{
Color c = orderGrid.RowsDefaultCellStyle.BackColor;
if (lastOrderDetail.IsHurryButcher)
c = ColorTranslator.FromHtml("#CC9999");
if (lastOrderDetail.SecondarySplit)
c = ColorTranslator.FromHtml("#6699CC");
row.DefaultCellStyle.BackColor = c;
break;
}
}
}
lastOrderDetail = entity;
var bc = orderGrid.RowsDefaultCellStyle.SelectionBackColor;
if (lastOrderDetail.IsHurryButcher)
bc = ColorTranslator.FromHtml("#FF9900");
if (lastOrderDetail.SecondarySplit)
bc = ColorTranslator.FromHtml("#006699");
orderGrid.CurrentRow.DefaultCellStyle.SelectionBackColor = bc;
orderGrid.Refresh();
}
bool? GetSelectType()
{
bool? type = null;
if (showAvailable.Checked)
type = true;
else if (showHidden.Checked)
type = false;
return type;
}
private void showRadio_CheckedChanged(object sender, EventArgs e)
{
BindPreOrderGrid();
}
int r1Roll = -1;
private void InitScrollBar2()
{
vScrollBar2.Maximum = (orderGrid.RowCount - orderGrid.DisplayedRowCount(false) + 30) * orderGrid.RowTemplate.Height;
vScrollBar2.Minimum = 0;
vScrollBar2.SmallChange = orderGrid.RowTemplate.Height;
vScrollBar2.LargeChange = orderGrid.RowTemplate.Height * 30;
this.vScrollBar2.Scroll += (sender, e) =>
{
r1Roll = e.NewValue / orderGrid.RowTemplate.Height;
orderGrid.FirstDisplayedScrollingRowIndex = r1Roll;
};
}
int r2Roll = -1;
private void InitScrollBar3()
{
vScrollBar3.Maximum = (preOrderGrid.RowCount - preOrderGrid.DisplayedRowCount(false) + 30) * preOrderGrid.RowTemplate.Height;
vScrollBar3.Minimum = 0;
vScrollBar3.SmallChange = preOrderGrid.RowTemplate.Height;
vScrollBar3.LargeChange = preOrderGrid.RowTemplate.Height * 30;
this.vScrollBar3.Scroll += (sender, e) =>
{
r2Roll = e.NewValue / preOrderGrid.RowTemplate.Height;
preOrderGrid.FirstDisplayedScrollingRowIndex = r2Roll;
};
}
}
}

+ 0
- 40
SegmentationWeight/DropDownSets.cs View File

@ -1,40 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SegmentationWeight
{
public class DropDownSets
{
public static readonly string = "车间";
public static readonly string = "单元";
public static readonly string = "批次";
public DropDownSets()
{
Details=new List<DropDownSet>();
}
public List<DropDownSet> Details { get; set; }
}
public class DropDownSet
{
public DropDownSet()
{
Details=new List<DropDownSet_Detail>();
}
public string Name { get; set; }
public List<DropDownSet_Detail> Details { get; set; }
}
public class DropDownSet_Detail
{
public long ID { get; set; }
public string Name { get; set; }
public string Code { get; set; }
}
}

+ 50
- 77
SegmentationWeight/SegmentationWeightForm.Designer.cs View File

@ -28,19 +28,17 @@
/// </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 dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = 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();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.panel1 = new System.Windows.Forms.Panel();
this.btnEnablePrint = new System.Windows.Forms.Button();
this.btnEnableWeight = new System.Windows.Forms.Button();
this.btnEnd = new System.Windows.Forms.Button();
this.btnStart = new System.Windows.Forms.Button();
this.picSyncStatus = new System.Windows.Forms.PictureBox();
this.picNetStatus = new System.Windows.Forms.PictureBox();
this.label11 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.panel3 = new System.Windows.Forms.Panel();
this.cbxBatch = new System.Windows.Forms.ComboBox();
@ -84,7 +82,6 @@
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picSyncStatus)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picNetStatus)).BeginInit();
this.panel3.SuspendLayout();
this.panel2.SuspendLayout();
@ -113,7 +110,7 @@
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(1117, 587);
this.splitContainer1.SplitterDistance = 125;
this.splitContainer1.SplitterDistance = 128;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 0;
//
@ -123,9 +120,7 @@
this.panel1.Controls.Add(this.btnEnableWeight);
this.panel1.Controls.Add(this.btnEnd);
this.panel1.Controls.Add(this.btnStart);
this.panel1.Controls.Add(this.picSyncStatus);
this.panel1.Controls.Add(this.picNetStatus);
this.panel1.Controls.Add(this.label11);
this.panel1.Controls.Add(this.label10);
this.panel1.Controls.Add(this.panel3);
this.panel1.Controls.Add(this.panel2);
@ -133,13 +128,13 @@
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1115, 123);
this.panel1.Size = new System.Drawing.Size(1115, 126);
this.panel1.TabIndex = 2;
//
// btnEnablePrint
//
this.btnEnablePrint.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnEnablePrint.Location = new System.Drawing.Point(468, 17);
this.btnEnablePrint.Location = new System.Drawing.Point(453, 19);
this.btnEnablePrint.Name = "btnEnablePrint";
this.btnEnablePrint.Size = new System.Drawing.Size(111, 34);
this.btnEnablePrint.TabIndex = 41;
@ -183,39 +178,20 @@
this.btnStart.UseVisualStyleBackColor = true;
this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
//
// picSyncStatus
//
this.picSyncStatus.ErrorImage = null;
this.picSyncStatus.InitialImage = null;
this.picSyncStatus.Location = new System.Drawing.Point(415, 65);
this.picSyncStatus.Name = "picSyncStatus";
this.picSyncStatus.Size = new System.Drawing.Size(30, 30);
this.picSyncStatus.TabIndex = 39;
this.picSyncStatus.TabStop = false;
//
// picNetStatus
//
this.picNetStatus.ErrorImage = null;
this.picNetStatus.InitialImage = null;
this.picNetStatus.Location = new System.Drawing.Point(415, 20);
this.picNetStatus.Location = new System.Drawing.Point(412, 20);
this.picNetStatus.Name = "picNetStatus";
this.picNetStatus.Size = new System.Drawing.Size(30, 30);
this.picNetStatus.TabIndex = 39;
this.picNetStatus.TabStop = false;
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(380, 76);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(29, 12);
this.label11.TabIndex = 35;
this.label11.Text = "同步";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(380, 28);
this.label10.Location = new System.Drawing.Point(377, 28);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(29, 12);
this.label10.TabIndex = 35;
@ -241,7 +217,7 @@
this.cbxBatch.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbxBatch.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cbxBatch.FormattingEnabled = true;
this.cbxBatch.Location = new System.Drawing.Point(56, 85);
this.cbxBatch.Location = new System.Drawing.Point(57, 84);
this.cbxBatch.Name = "cbxBatch";
this.cbxBatch.Size = new System.Drawing.Size(121, 24);
this.cbxBatch.TabIndex = 39;
@ -252,7 +228,7 @@
this.cbxWorkUnit.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbxWorkUnit.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cbxWorkUnit.FormattingEnabled = true;
this.cbxWorkUnit.Location = new System.Drawing.Point(57, 48);
this.cbxWorkUnit.Location = new System.Drawing.Point(57, 45);
this.cbxWorkUnit.Name = "cbxWorkUnit";
this.cbxWorkUnit.Size = new System.Drawing.Size(121, 24);
this.cbxWorkUnit.TabIndex = 40;
@ -269,7 +245,7 @@
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(9, 55);
this.label5.Location = new System.Drawing.Point(9, 52);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(41, 12);
this.label5.TabIndex = 37;
@ -345,7 +321,7 @@
this.splitContainer2.Panel2.Controls.Add(this.btnRePrint);
this.splitContainer2.Panel2.Controls.Add(this.uDataGridView1);
this.splitContainer2.Panel2.Controls.Add(this.tableLayoutPanel1);
this.splitContainer2.Size = new System.Drawing.Size(1117, 461);
this.splitContainer2.Size = new System.Drawing.Size(1117, 458);
this.splitContainer2.SplitterDistance = 729;
this.splitContainer2.SplitterWidth = 1;
this.splitContainer2.TabIndex = 0;
@ -425,20 +401,20 @@
this.uDataGridView1.AllowUserToDeleteRows = false;
this.uDataGridView1.AllowUserToResizeColumns = false;
this.uDataGridView1.AllowUserToResizeRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle17.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle17;
this.uDataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.uDataGridView1.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.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle18.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle18.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle18.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle18.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle18.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle18;
this.uDataGridView1.ColumnHeadersHeight = 40;
this.uDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.uDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@ -451,12 +427,12 @@
this.uDataGridView1.Name = "uDataGridView1";
this.uDataGridView1.ReadOnly = true;
this.uDataGridView1.RowHeadersVisible = false;
dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle4;
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.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle20;
this.uDataGridView1.RowTemplate.Height = 40;
this.uDataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.uDataGridView1.Size = new System.Drawing.Size(389, 295);
this.uDataGridView1.Size = new System.Drawing.Size(395, 295);
this.uDataGridView1.TabIndex = 1;
//
// 序号
@ -489,8 +465,8 @@
// 重量
//
this..DataPropertyName = "Weight";
dataGridViewCellStyle3.Format = "#0.##";
this..DefaultCellStyle = dataGridViewCellStyle3;
dataGridViewCellStyle19.Format = "#0.##";
this..DefaultCellStyle = dataGridViewCellStyle19;
this..HeaderText = "重量";
this..Name = "重量";
this..ReadOnly = true;
@ -506,7 +482,7 @@
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 41.77215F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 68F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 58F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 87F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 91F));
this.tableLayoutPanel1.Controls.Add(this.lblGoodsName, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.label8, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.label3, 1, 1);
@ -527,7 +503,7 @@
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(392, 98);
this.tableLayoutPanel1.Size = new System.Drawing.Size(398, 98);
this.tableLayoutPanel1.TabIndex = 0;
//
// lblGoodsName
@ -538,7 +514,7 @@
this.lblGoodsName.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblGoodsName.Location = new System.Drawing.Point(4, 33);
this.lblGoodsName.Name = "lblGoodsName";
this.lblGoodsName.Size = new System.Drawing.Size(94, 31);
this.lblGoodsName.Size = new System.Drawing.Size(95, 31);
this.lblGoodsName.TabIndex = 0;
this.lblGoodsName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
@ -550,7 +526,7 @@
this.label8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label8.Location = new System.Drawing.Point(4, 1);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(94, 31);
this.label8.Size = new System.Drawing.Size(95, 31);
this.label8.TabIndex = 0;
this.label8.Text = "产品";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -561,9 +537,9 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(105, 33);
this.label3.Location = new System.Drawing.Point(106, 33);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(66, 31);
this.label3.Size = new System.Drawing.Size(67, 31);
this.label3.TabIndex = 0;
this.label3.Text = "重量";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -574,9 +550,9 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(105, 65);
this.label2.Location = new System.Drawing.Point(106, 65);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(66, 32);
this.label2.Size = new System.Drawing.Size(67, 32);
this.label2.TabIndex = 0;
this.label2.Text = "数量";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -587,9 +563,9 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label7.Location = new System.Drawing.Point(306, 1);
this.label7.Location = new System.Drawing.Point(308, 1);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(82, 31);
this.label7.Size = new System.Drawing.Size(86, 31);
this.label7.TabIndex = 0;
this.label7.Text = "剩余";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -600,7 +576,7 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label9.Location = new System.Drawing.Point(247, 1);
this.label9.Location = new System.Drawing.Point(249, 1);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(52, 31);
this.label9.TabIndex = 0;
@ -613,7 +589,7 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblPlanWeight.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblPlanWeight.Location = new System.Drawing.Point(178, 33);
this.lblPlanWeight.Location = new System.Drawing.Point(180, 33);
this.lblPlanWeight.Name = "lblPlanWeight";
this.lblPlanWeight.Size = new System.Drawing.Size(62, 31);
this.lblPlanWeight.TabIndex = 0;
@ -625,7 +601,7 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblNumber.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblNumber.Location = new System.Drawing.Point(247, 65);
this.lblNumber.Location = new System.Drawing.Point(249, 65);
this.lblNumber.Name = "lblNumber";
this.lblNumber.Size = new System.Drawing.Size(52, 32);
this.lblNumber.TabIndex = 0;
@ -637,7 +613,7 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblWeight.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblWeight.Location = new System.Drawing.Point(247, 33);
this.lblWeight.Location = new System.Drawing.Point(249, 33);
this.lblWeight.Name = "lblWeight";
this.lblWeight.Size = new System.Drawing.Size(52, 31);
this.lblWeight.TabIndex = 0;
@ -649,7 +625,7 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblPlanNumber.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblPlanNumber.Location = new System.Drawing.Point(178, 65);
this.lblPlanNumber.Location = new System.Drawing.Point(180, 65);
this.lblPlanNumber.Name = "lblPlanNumber";
this.lblPlanNumber.Size = new System.Drawing.Size(62, 32);
this.lblPlanNumber.TabIndex = 0;
@ -661,7 +637,7 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(178, 1);
this.label1.Location = new System.Drawing.Point(180, 1);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(62, 31);
this.label1.TabIndex = 0;
@ -674,9 +650,9 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblLeftWeight.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblLeftWeight.Location = new System.Drawing.Point(306, 33);
this.lblLeftWeight.Location = new System.Drawing.Point(308, 33);
this.lblLeftWeight.Name = "lblLeftWeight";
this.lblLeftWeight.Size = new System.Drawing.Size(82, 31);
this.lblLeftWeight.Size = new System.Drawing.Size(86, 31);
this.lblLeftWeight.TabIndex = 0;
this.lblLeftWeight.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
@ -686,9 +662,9 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblLeftNumber.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblLeftNumber.Location = new System.Drawing.Point(306, 65);
this.lblLeftNumber.Location = new System.Drawing.Point(308, 65);
this.lblLeftNumber.Name = "lblLeftNumber";
this.lblLeftNumber.Size = new System.Drawing.Size(82, 32);
this.lblLeftNumber.Size = new System.Drawing.Size(86, 32);
this.lblLeftNumber.TabIndex = 0;
this.lblLeftNumber.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
@ -700,7 +676,7 @@
this.lblGoodsSpec.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblGoodsSpec.Location = new System.Drawing.Point(4, 65);
this.lblGoodsSpec.Name = "lblGoodsSpec";
this.lblGoodsSpec.Size = new System.Drawing.Size(94, 32);
this.lblGoodsSpec.Size = new System.Drawing.Size(95, 32);
this.lblGoodsSpec.TabIndex = 0;
this.lblGoodsSpec.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
@ -722,7 +698,6 @@
this.splitContainer1.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picSyncStatus)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picNetStatus)).EndInit();
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
@ -771,9 +746,7 @@
private System.Windows.Forms.Label lblPlanNumber;
private System.Windows.Forms.Label lblLeftWeight;
private System.Windows.Forms.Label lblLeftNumber;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.PictureBox picSyncStatus;
private System.Windows.Forms.PictureBox picNetStatus;
private System.Windows.Forms.Button btnEnd;
private System.Windows.Forms.Button btnStart;


+ 36
- 40
SegmentationWeight/SegmentationWeightForm.cs View File

@ -48,7 +48,7 @@ namespace SegmentationWeight
private readonly Thread _tdSyncAlreadyFromMiddleDb;
private readonly Thread _tdSyncLocalToMiddleDb;
private readonly Thread _tcCheckNetStatus;
private readonly Thread _tcCheckSyncStatus;
//private readonly Thread _tcCheckSyncStatus;
public SegmentationWeightForm()
{
@ -73,10 +73,10 @@ namespace SegmentationWeight
{
_tcCheckNetStatus.Abort();
}
if (_tcCheckSyncStatus != null && _tcCheckSyncStatus.IsAlive)
{
_tcCheckSyncStatus.Abort();
}
//if (_tcCheckSyncStatus != null && _tcCheckSyncStatus.IsAlive)
//{
// _tcCheckSyncStatus.Abort();
//}
};
InitCombox();
@ -91,36 +91,36 @@ namespace SegmentationWeight
_tcCheckNetStatus = new Thread(CheckNetStatus);
_tcCheckNetStatus.Start();
_tcCheckSyncStatus = new Thread(CheckSyncStatus);
_tcCheckSyncStatus.Start();
}
private void CheckSyncStatus()
{
while (true)
{
var syncSuccessed = SegmentationWeightRecordRpc.GetInstance().IsSyncSucessed();
var png = "stop.png";
if (syncSuccessed)
png = "working.png";
var imgPath = Path.Combine(Application.StartupPath, "BWP.WinFormControl.dll");
var s = Assembly.LoadFile(imgPath).GetManifestResourceStream("BWP.WinFormControl.Images." + png);
if (this.InvokeRequired)
{
this.BeginInvoke(new Action(() =>
{
picSyncStatus.Image = Image.FromStream(s);
picSyncStatus.Refresh();
}));
}
else
{
picSyncStatus.Image = Image.FromStream(s);
picSyncStatus.Refresh();
}
Thread.Sleep(1000);
}
}
//_tcCheckSyncStatus = new Thread(CheckSyncStatus);
//_tcCheckSyncStatus.Start();
}
//private void CheckSyncStatus()
//{
// while (true)
// {
// var syncSuccessed = SegmentationWeightRecordRpc.GetInstance().IsSyncSucessed();
// var png = "stop.png";
// if (syncSuccessed)
// png = "working.png";
// var imgPath = Path.Combine(Application.StartupPath, "BWP.WinFormControl.dll");
// var s = Assembly.LoadFile(imgPath).GetManifestResourceStream("BWP.WinFormControl.Images." + png);
// if (this.InvokeRequired)
// {
// this.BeginInvoke(new Action(() =>
// {
// picSyncStatus.Image = Image.FromStream(s);
// picSyncStatus.Refresh();
// }));
// }
// else
// {
// picSyncStatus.Image = Image.FromStream(s);
// picSyncStatus.Refresh();
// }
// Thread.Sleep(1000);
// }
//}
private bool laseConnection = false;
@ -752,8 +752,7 @@ namespace SegmentationWeight
private SegmentationWeightRecord GetRecordBySet(SegmentationWeightGoodSet set)
{
var unitValue = cbxWorkUnit.SelectedValue.ToString();
if (string.IsNullOrWhiteSpace(unitValue))
if (cbxWorkUnit.SelectedValue==null)
{
throw new Exception("请选择工作单元");
}
@ -784,9 +783,6 @@ namespace SegmentationWeight
return indexCode;
}
public string RoleName { get { return "分割称重"; } }
public Form Generate()
{


Loading…
Cancel
Save