Browse Source

加入线下区分工艺的客户端。

master
yibo 7 years ago
parent
commit
b5c45c4ebb
12 changed files with 2930 additions and 118 deletions
  1. +8
    -2
      B3ButcherManageClient.sln
  2. +4
    -0
      BO/BO/Bill/OrderDetail/OrderDetail.cs
  3. +2
    -0
      BO/Utils/AfterLoginUtil.cs
  4. +80
    -0
      OffLineQualityAndOrder/OffLineQualityAndOrder.csproj
  5. +1264
    -0
      OffLineQualityAndOrder/OffLineQualityOrderForm.Designer.cs
  6. +724
    -0
      OffLineQualityAndOrder/OffLineQualityOrderForm.cs
  7. +246
    -0
      OffLineQualityAndOrder/OffLineQualityOrderForm.resx
  8. +418
    -0
      OffLineQualityAndOrder/OffLineQualityOrderFormForTab2.cs
  9. +36
    -0
      OffLineQualityAndOrder/Properties/AssemblyInfo.cs
  10. +127
    -116
      OrderConfirm/OrderConfirmForm.Designer.cs
  11. +18
    -0
      OrderConfirm/OrderConfirmForm.cs
  12. +3
    -0
      OrderConfirm/OrderConfirmForm.resx

+ 8
- 2
B3ButcherManageClient.sln View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2020
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BO", "BO\BO.csproj", "{8968F14A-C7C7-4751-96CE-B114FBFD65EF}"
EndProject
@ -41,6 +41,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormTest", "WinFormTest\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaterialRequisition", "MaterialRequisition\MaterialRequisition.csproj", "{756CB09C-D46E-4BFD-8417-4EA531102E4A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OffLineQualityAndOrder", "OffLineQualityAndOrder\OffLineQualityAndOrder.csproj", "{20BB780C-237B-4998-9ABF-85951596E4FF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -121,6 +123,10 @@ Global
{756CB09C-D46E-4BFD-8417-4EA531102E4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{756CB09C-D46E-4BFD-8417-4EA531102E4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{756CB09C-D46E-4BFD-8417-4EA531102E4A}.Release|Any CPU.Build.0 = Release|Any CPU
{20BB780C-237B-4998-9ABF-85951596E4FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{20BB780C-237B-4998-9ABF-85951596E4FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{20BB780C-237B-4998-9ABF-85951596E4FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{20BB780C-237B-4998-9ABF-85951596E4FF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE


+ 4
- 0
BO/BO/Bill/OrderDetail/OrderDetail.cs View File

@ -32,6 +32,10 @@ namespace BO.BO.Bill
public bool IsHurryButcher { get; set; }
public short? Technics { get; set; }
public string Technics_Name { get; set; }
public bool SecondarySplit { get; set; }
//0 = 未开始; 10 = 已开始; 20 = 已完毕;


+ 2
- 0
BO/Utils/AfterLoginUtil.cs View File

@ -22,6 +22,7 @@ namespace BO.Utils
static List<Tuple<string, string>> roleToAssemblies = new List<Tuple<string, string>>(){new Tuple<string,string>("排宰员",@"C:\BwpB3Project\src\B3ButcherManageClient\ButcherOrder\bin\Debug\ButcherOrder"),
new Tuple<string,string>("过磅员",@"C:\BwpB3Project\src\B3ButcherManageClient\ButcherWeight\bin\Debug\ButcherWeight"),
new Tuple<string,string>("验质员",@"C:\BwpB3Project\src\B3ButcherManageClient\QualityAndOrder\bin\Debug\QualityAndOrder"),
new Tuple<string,string>("验质排宰",@"C:\BwpB3Project\src\B3ButcherManageClient\OffLineQualityAndOrder\bin\Debug\OffLineQualityAndOrder"),
new Tuple<string,string>("定级员",@"C:\BwpB3Project\src\B3ButcherManageClient\WeighAndGrading\bin\Debug\WeighAndGrading"),
new Tuple<string,string>("窒晕员",@"C:\BwpB3Project\src\B3ButcherManageClient\OrderConfirm\bin\Debug\OrderConfirm"),
new Tuple<string,string>("白条入库",@"C:\BwpB3Project\src\B3ButcherManageClient\TrunksIousOutInStore\bin\Debug\TrunksIousOutInStore"),
@ -53,6 +54,7 @@ namespace BO.Utils
new Tuple<string,string>("排宰员",@"ButcherOrder"),
new Tuple<string,string>("过磅员",@"ButcherWeight"),
new Tuple<string,string>("验质员",@"QualityAndOrder"),
new Tuple<string,string>("验质排宰",@"OffLineQualityAndOrder"),
new Tuple<string,string>("定级员",@"WeighAndGrading"),
new Tuple<string,string>("窒晕员",@"OrderConfirm"),
new Tuple<string,string>("掉猪处理员",@"DropPigReOrder"),


+ 80
- 0
OffLineQualityAndOrder/OffLineQualityAndOrder.csproj View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{20BB780C-237B-4998-9ABF-85951596E4FF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OffLineQualityAndOrder</RootNamespace>
<AssemblyName>OffLineQualityAndOrder</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="OffLineQualityOrderForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="OffLineQualityOrderForm.Designer.cs">
<DependentUpon>OffLineQualityOrderForm.cs</DependentUpon>
</Compile>
<Compile Include="OffLineQualityOrderFormForTab2.cs">
<SubType>Form</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BO\BO.csproj">
<Project>{8968f14a-c7c7-4751-96ce-b114fbfd65ef}</Project>
<Name>BO</Name>
</ProjectReference>
<ProjectReference Include="..\BWP.WinFormControl\BWP.WinFormControl.csproj">
<Project>{a782b23e-be6d-4f51-b5cb-5cd259ba97cc}</Project>
<Name>BWP.WinFormControl</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="OffLineQualityOrderForm.resx">
<DependentUpon>OffLineQualityOrderForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

+ 1264
- 0
OffLineQualityAndOrder/OffLineQualityOrderForm.Designer.cs
File diff suppressed because it is too large
View File


+ 724
- 0
OffLineQualityAndOrder/OffLineQualityOrderForm.cs View File

@ -0,0 +1,724 @@
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 OffLineQualityOrderForm : 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 OffLineQualityOrderForm()
{
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();
};
Tab2Init();
}
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;
}
}
}

+ 246
- 0
OffLineQualityAndOrder/OffLineQualityOrderForm.resx View File

@ -0,0 +1,246 @@
<?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_Technics.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>
</root>

+ 418
- 0
OffLineQualityAndOrder/OffLineQualityOrderFormForTab2.cs View File

@ -0,0 +1,418 @@
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 OffLineQualityAndOrder
{
partial class OffLineQualityOrderForm
{
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 ((short)row.Cells["O_Technics"].Value == 0)
row.DefaultCellStyle.BackColor = green;
else
row.DefaultCellStyle.BackColor = yellow;
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)
{
if (gy == .)
throw new Exception("请指定工艺");
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.Technics = (short)gy;
order.Technics_Name = gy.ToString();
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");
if (lastOrderDetail.Technics == 0)
c = green;
else
c = yellow;
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;
};
}
gy = .;
private void tangBtn_Click(object sender, EventArgs e)
{
gy = .;
SetTechBtnChecked(tangBtn, green);
SetBtnUnCheck(maoBtn);
}
private void maoBtn_Click(object sender, EventArgs e)
{
gy = .;
SetTechBtnChecked(maoBtn, yellow);
SetBtnUnCheck(tangBtn);
}
void SetTechBtnChecked(Button btn, Color c)
{
btn.BackColor = c;
btn.ForeColor = btnSelectForeColor;
}
Color green = ColorTranslator.FromHtml("#3CC24C");
Color yellow = ColorTranslator.FromHtml("#FFDE5A");
}
enum
{
= -1,
= 0,
= 1
}
}

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

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

+ 127
- 116
OrderConfirm/OrderConfirmForm.Designer.cs View File

@ -34,12 +34,23 @@
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
this.orderGrid = new BWP.WinFormControl.UDataGridView();
this.existBtn = new System.Windows.Forms.Button();
this.orderLabel = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.syncBtn = new System.Windows.Forms.Button();
this.uDatePicker1 = new BWP.WinFormControl.UDatePicker();
this.label1 = new System.Windows.Forms.Label();
this.vScrollBar1 = new System.Windows.Forms.VScrollBar();
this.setTop = new System.Windows.Forms.CheckBox();
this.finishNumberLabel = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.C_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.C_IsHurryButcher = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.C_WeightBill_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.C_SecondarySplit = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.C_OrderState = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.C_Date = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.C_Technics = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.C_Order = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.C_B3WeighBill_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.C_Supplier_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
@ -47,16 +58,6 @@
this.C_PlanNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.C_OK = new System.Windows.Forms.DataGridViewButtonColumn();
this.C_Finish = new System.Windows.Forms.DataGridViewButtonColumn();
this.existBtn = new System.Windows.Forms.Button();
this.orderLabel = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.syncBtn = new System.Windows.Forms.Button();
this.uDatePicker1 = new BWP.WinFormControl.UDatePicker();
this.label1 = new System.Windows.Forms.Label();
this.vScrollBar1 = new System.Windows.Forms.VScrollBar();
this.setTop = new System.Windows.Forms.CheckBox();
this.finishNumberLabel = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.orderGrid)).BeginInit();
this.SuspendLayout();
//
@ -85,6 +86,7 @@
this.C_SecondarySplit,
this.C_OrderState,
this.C_Date,
this.C_Technics,
this.C_Order,
this.C_B3WeighBill_ID,
this.C_Supplier_Name,
@ -110,6 +112,110 @@
this.orderGrid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.orderGrid_CellClick);
this.orderGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.orderGrid_CellContentClick);
//
// existBtn
//
this.existBtn.Font = new System.Drawing.Font("宋体", 15F);
this.existBtn.Location = new System.Drawing.Point(974, 12);
this.existBtn.Name = "existBtn";
this.existBtn.Size = new System.Drawing.Size(108, 41);
this.existBtn.TabIndex = 12;
this.existBtn.Text = "退出";
this.existBtn.UseVisualStyleBackColor = true;
this.existBtn.Click += new System.EventHandler(this.existBtn_Click);
//
// orderLabel
//
this.orderLabel.AutoSize = true;
this.orderLabel.Font = new System.Drawing.Font("宋体", 15F);
this.orderLabel.Location = new System.Drawing.Point(617, 21);
this.orderLabel.Name = "orderLabel";
this.orderLabel.Size = new System.Drawing.Size(19, 20);
this.orderLabel.TabIndex = 11;
this.orderLabel.Text = "0";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 15F);
this.label2.Location = new System.Drawing.Point(519, 21);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(109, 20);
this.label2.TabIndex = 10;
this.label2.Text = "排宰顺序:";
//
// syncBtn
//
this.syncBtn.Font = new System.Drawing.Font("宋体", 15F);
this.syncBtn.Location = new System.Drawing.Point(359, 12);
this.syncBtn.Name = "syncBtn";
this.syncBtn.Size = new System.Drawing.Size(108, 41);
this.syncBtn.TabIndex = 9;
this.syncBtn.Text = "同步数据";
this.syncBtn.UseVisualStyleBackColor = true;
this.syncBtn.Click += new System.EventHandler(this.syncBtn_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(158, 17);
this.uDatePicker1.Name = "uDatePicker1";
this.uDatePicker1.Size = new System.Drawing.Size(175, 30);
this.uDatePicker1.TabIndex = 8;
this.uDatePicker1.Text = "2017/09/05";
this.uDatePicker1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.uDatePicker1.Type = BWP.WinFormControl.DateTimeType.Date;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 15F);
this.label1.Location = new System.Drawing.Point(43, 22);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(109, 20);
this.label1.TabIndex = 7;
this.label1.Text = "宰杀日期:";
//
// vScrollBar1
//
this.vScrollBar1.Location = new System.Drawing.Point(1042, 73);
this.vScrollBar1.Name = "vScrollBar1";
this.vScrollBar1.Size = new System.Drawing.Size(40, 698);
this.vScrollBar1.TabIndex = 52;
//
// setTop
//
this.setTop.AutoSize = true;
this.setTop.Font = new System.Drawing.Font("宋体", 15F);
this.setTop.Location = new System.Drawing.Point(845, 20);
this.setTop.Name = "setTop";
this.setTop.Size = new System.Drawing.Size(68, 24);
this.setTop.TabIndex = 53;
this.setTop.Text = "置顶";
this.setTop.UseVisualStyleBackColor = true;
//
// finishNumberLabel
//
this.finishNumberLabel.AutoSize = true;
this.finishNumberLabel.Font = new System.Drawing.Font("宋体", 15F);
this.finishNumberLabel.Location = new System.Drawing.Point(758, 21);
this.finishNumberLabel.Name = "finishNumberLabel";
this.finishNumberLabel.Size = new System.Drawing.Size(19, 20);
this.finishNumberLabel.TabIndex = 55;
this.finishNumberLabel.Text = "0";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("宋体", 15F);
this.label4.Location = new System.Drawing.Point(660, 21);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(109, 20);
this.label4.TabIndex = 54;
this.label4.Text = "已杀头数:";
//
// C_ID
//
this.C_ID.DataPropertyName = "ID";
@ -158,6 +264,14 @@
this.C_Date.ReadOnly = true;
this.C_Date.Visible = false;
//
// C_Technics
//
this.C_Technics.DataPropertyName = "Technics";
this.C_Technics.HeaderText = "Technics";
this.C_Technics.Name = "C_Technics";
this.C_Technics.ReadOnly = true;
this.C_Technics.Visible = false;
//
// C_Order
//
this.C_Order.DataPropertyName = "Order";
@ -218,110 +332,6 @@
this.C_Finish.UseColumnTextForButtonValue = true;
this.C_Finish.Width = 170;
//
// existBtn
//
this.existBtn.Font = new System.Drawing.Font("宋体", 15F);
this.existBtn.Location = new System.Drawing.Point(974, 12);
this.existBtn.Name = "existBtn";
this.existBtn.Size = new System.Drawing.Size(108, 41);
this.existBtn.TabIndex = 12;
this.existBtn.Text = "退出";
this.existBtn.UseVisualStyleBackColor = true;
this.existBtn.Click += new System.EventHandler(this.existBtn_Click);
//
// orderLabel
//
this.orderLabel.AutoSize = true;
this.orderLabel.Font = new System.Drawing.Font("宋体", 15F);
this.orderLabel.Location = new System.Drawing.Point(617, 21);
this.orderLabel.Name = "orderLabel";
this.orderLabel.Size = new System.Drawing.Size(19, 20);
this.orderLabel.TabIndex = 11;
this.orderLabel.Text = "0";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 15F);
this.label2.Location = new System.Drawing.Point(519, 21);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(109, 20);
this.label2.TabIndex = 10;
this.label2.Text = "排宰顺序:";
//
// syncBtn
//
this.syncBtn.Font = new System.Drawing.Font("宋体", 15F);
this.syncBtn.Location = new System.Drawing.Point(359, 12);
this.syncBtn.Name = "syncBtn";
this.syncBtn.Size = new System.Drawing.Size(108, 41);
this.syncBtn.TabIndex = 9;
this.syncBtn.Text = "同步数据";
this.syncBtn.UseVisualStyleBackColor = true;
this.syncBtn.Click += new System.EventHandler(this.syncBtn_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(158, 17);
this.uDatePicker1.Name = "uDatePicker1";
this.uDatePicker1.Size = new System.Drawing.Size(175, 30);
this.uDatePicker1.TabIndex = 8;
this.uDatePicker1.Text = "2017/09/05";
this.uDatePicker1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.uDatePicker1.Type = BWP.WinFormControl.DateTimeType.Date;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 15F);
this.label1.Location = new System.Drawing.Point(43, 22);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(109, 20);
this.label1.TabIndex = 7;
this.label1.Text = "宰杀日期:";
//
// vScrollBar1
//
this.vScrollBar1.Location = new System.Drawing.Point(1042, 73);
this.vScrollBar1.Name = "vScrollBar1";
this.vScrollBar1.Size = new System.Drawing.Size(40, 698);
this.vScrollBar1.TabIndex = 52;
//
// setTop
//
this.setTop.AutoSize = true;
this.setTop.Font = new System.Drawing.Font("宋体", 15F);
this.setTop.Location = new System.Drawing.Point(845, 20);
this.setTop.Name = "setTop";
this.setTop.Size = new System.Drawing.Size(68, 24);
this.setTop.TabIndex = 53;
this.setTop.Text = "置顶";
this.setTop.UseVisualStyleBackColor = true;
//
// finishNumberLabel
//
this.finishNumberLabel.AutoSize = true;
this.finishNumberLabel.Font = new System.Drawing.Font("宋体", 15F);
this.finishNumberLabel.Location = new System.Drawing.Point(758, 21);
this.finishNumberLabel.Name = "finishNumberLabel";
this.finishNumberLabel.Size = new System.Drawing.Size(19, 20);
this.finishNumberLabel.TabIndex = 55;
this.finishNumberLabel.Text = "0";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("宋体", 15F);
this.label4.Location = new System.Drawing.Point(660, 21);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(109, 20);
this.label4.TabIndex = 54;
this.label4.Text = "已杀头数:";
//
// OrderConfirmForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@ -362,12 +372,15 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.VScrollBar vScrollBar1;
private System.Windows.Forms.CheckBox setTop;
private System.Windows.Forms.Label finishNumberLabel;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.DataGridViewTextBoxColumn C_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn C_IsHurryButcher;
private System.Windows.Forms.DataGridViewTextBoxColumn C_WeightBill_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn C_SecondarySplit;
private System.Windows.Forms.DataGridViewTextBoxColumn C_OrderState;
private System.Windows.Forms.DataGridViewTextBoxColumn C_Date;
private System.Windows.Forms.DataGridViewTextBoxColumn C_Technics;
private System.Windows.Forms.DataGridViewTextBoxColumn C_Order;
private System.Windows.Forms.DataGridViewTextBoxColumn C_B3WeighBill_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn C_Supplier_Name;
@ -375,7 +388,5 @@
private System.Windows.Forms.DataGridViewTextBoxColumn C_PlanNumber;
private System.Windows.Forms.DataGridViewButtonColumn C_OK;
private System.Windows.Forms.DataGridViewButtonColumn C_Finish;
private System.Windows.Forms.Label finishNumberLabel;
private System.Windows.Forms.Label label4;
}
}

+ 18
- 0
OrderConfirm/OrderConfirmForm.cs View File

@ -98,6 +98,14 @@ namespace OrderConfirm
row.DefaultCellStyle.BackColor = ColorTranslator.FromHtml("#CC9999");
if ((bool)row.Cells["C_SecondarySplit"].Value)
row.DefaultCellStyle.BackColor = ColorTranslator.FromHtml("#6699CC");
var tech = (short?)row.Cells["C_Technics"].Value;
if (tech.HasValue)
{
if (tech == 0)
row.DefaultCellStyle.BackColor = green;
else
row.DefaultCellStyle.BackColor = yellow;
}
((DataGridViewButtonCell)row.Cells["C_OK"]).Value = state == 0 ? "开始" : "取消";
if (lastOrderDetail != null && lastOrderDetail.ID == (long)row.Cells["C_ID"].Value)
{
@ -159,6 +167,13 @@ namespace OrderConfirm
c = ColorTranslator.FromHtml("#CC9999");
if (lastOrderDetail.SecondarySplit)
c = ColorTranslator.FromHtml("#6699CC");
if (lastOrderDetail.Technics.HasValue)
{
if (lastOrderDetail.Technics == 0)
c = green;
else
c = yellow;
}
row.DefaultCellStyle.BackColor = c;
break;
}
@ -259,5 +274,8 @@ namespace OrderConfirm
lastOrderDetail = order;
BindOrderGrid();
}
Color green = ColorTranslator.FromHtml("#3CC24C");
Color yellow = ColorTranslator.FromHtml("#FFDE5A");
}
}

+ 3
- 0
OrderConfirm/OrderConfirmForm.resx View File

@ -135,6 +135,9 @@
<metadata name="C_Date.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="C_Technics.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="C_Order.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>


Loading…
Cancel
Save