Browse Source

修改。

master
yibo 8 years ago
parent
commit
c756e02ced
28 changed files with 2287 additions and 306 deletions
  1. +4
    -0
      B3ButcherManageClient.sln
  2. +1
    -0
      BO/BO.csproj
  3. +1
    -0
      BO/BO/Bill/WeightBill/WeightBill.cs
  4. +59
    -0
      BO/Utils/AfterLoginUtil.cs
  5. +66
    -15
      BO/Utils/BillRpc/WeightBillRpc.cs
  6. +3
    -2
      BO/Utils/LoginRpcUtil.cs
  7. +2
    -0
      BO/Utils/LoginUserInfo.cs
  8. +10
    -2
      BWP.WinFormControl/WeightControl.Designer.cs
  9. +60
    -53
      BWP.WinFormControl/WeightControl.cs
  10. +0
    -50
      ButcherManageClient/AfterLoginUtil.cs
  11. +0
    -1
      ButcherManageClient/ButcherManageClient.csproj
  12. +1
    -1
      ButcherManageClient/Login.cs
  13. +0
    -4
      ButcherOrder/ButcherOrder.csproj
  14. +1
    -7
      ButcherOrder/ButcherOrderForm.cs
  15. +10
    -4
      ButcherWeight/ButcherWeight.csproj
  16. +203
    -0
      ButcherWeight/WeightConfig.Designer.cs
  17. +64
    -0
      ButcherWeight/WeightConfig.cs
  18. +120
    -0
      ButcherWeight/WeightConfig.resx
  19. +78
    -0
      ButcherWeight/WeightContext.cs
  20. +91
    -75
      ButcherWeight/WeightForm.Designer.cs
  21. +116
    -8
      ButcherWeight/WeightForm.cs
  22. +0
    -4
      QualityAndOrder/QualityAndOrder.csproj
  23. +58
    -58
      QualityAndOrder/QualityOrderForm.Designer.cs
  24. +43
    -19
      QualityAndOrder/QualityOrderForm.cs
  25. +3
    -3
      QualityAndOrder/QualityOrderForm.resx
  26. BIN
      Setup/Release/Setup.msi
  27. BIN
      Setup/Release/setup.exe
  28. +1293
    -0
      Setup/Setup.vdproj

+ 4
- 0
B3ButcherManageClient.sln View File

@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ButcherWeight", "ButcherWei
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QualityAndOrder", "QualityAndOrder\QualityAndOrder.csproj", "{0C26ABF1-A45D-4107-ADC8-0235BCD18043}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QualityAndOrder", "QualityAndOrder\QualityAndOrder.csproj", "{0C26ABF1-A45D-4107-ADC8-0235BCD18043}"
EndProject EndProject
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Setup", "Setup\Setup.vdproj", "{69447304-329D-448B-A6D4-342B9FBAD15D}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -45,6 +47,8 @@ Global
{0C26ABF1-A45D-4107-ADC8-0235BCD18043}.Debug|Any CPU.Build.0 = Debug|Any CPU {0C26ABF1-A45D-4107-ADC8-0235BCD18043}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C26ABF1-A45D-4107-ADC8-0235BCD18043}.Release|Any CPU.ActiveCfg = Release|Any CPU {0C26ABF1-A45D-4107-ADC8-0235BCD18043}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C26ABF1-A45D-4107-ADC8-0235BCD18043}.Release|Any CPU.Build.0 = Release|Any CPU {0C26ABF1-A45D-4107-ADC8-0235BCD18043}.Release|Any CPU.Build.0 = Release|Any CPU
{69447304-329D-448B-A6D4-342B9FBAD15D}.Debug|Any CPU.ActiveCfg = Debug
{69447304-329D-448B-A6D4-342B9FBAD15D}.Release|Any CPU.ActiveCfg = Release
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE


+ 1
- 0
BO/BO.csproj View File

@ -52,6 +52,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Utils\AfterLoginUtil.cs" />
<Compile Include="Utils\ButcherAppContext.cs" /> <Compile Include="Utils\ButcherAppContext.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill.cs" /> <Compile Include="BO\Bill\WeightBill\WeightBill.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill_Detail.cs" /> <Compile Include="BO\Bill\WeightBill\WeightBill_Detail.cs" />


+ 1
- 0
BO/BO/Bill/WeightBill/WeightBill.cs View File

@ -72,6 +72,7 @@ namespace BO.BO
public string Remark { get; set; } public string Remark { get; set; }
public bool AlreadyHouse { get; set; }
private List<WeightBill_Detail> _details = new List<WeightBill_Detail>(); private List<WeightBill_Detail> _details = new List<WeightBill_Detail>();
public List<WeightBill_Detail> Details { get { return _details; } } public List<WeightBill_Detail> Details { get { return _details; } }


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

@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BO.Utils
{
public interface IAfterLogin
{
string RoleName { get; }
Form Generate();
}
public static class AfterLoginUtil
{
//#if debug
static List<Tuple<string, string>> roleToAssemblies= new List<Tuple<string, string>>(){new Tuple<string,string>("排宰员",@"C:\B3Service\src\B3ButcherManageClient\ButcherOrder\bin\Debug\ButcherOrder"),
new Tuple<string,string>("过磅员",@"C:\B3Service\src\B3ButcherManageClient\ButcherWeight\bin\Debug\ButcherWeight"),
new Tuple<string,string>("验质员",@"C:\B3Service\src\B3ButcherManageClient\QualityAndOrder\bin\Debug\QualityAndOrder")};
//#endif
//#if relase
// static List<Tuple<string, string>> roleToAssemblies = new List<Tuple<string, string>>(){new Tuple<string,string>("排宰员",@"ButcherOrder"),
// new Tuple<string,string>("过磅员",@"ButcherWeight"),
// new Tuple<string,string>("验质员",@"QualityAndOrder")};
//#endif
public static Form CreateForm(string role)
{
var first = roleToAssemblies.FirstOrDefault(x => x.Item1 == role);
if (first == null)
throw new Exception("未注册的角色");
//#if debug
var filePath = string.Format("{0}.dll", first.Item2);
//#endif
//#if relase
// var filePath = Path.Combine(Application.StartupPath, string.Format("{0}.dll", first.Item2));
//#endif
if (!File.Exists(filePath))
throw new Exception("相关模块不存在");
var formType = typeof(IAfterLogin);
foreach (var type in Assembly.LoadFile(filePath).GetTypes())
{
if (formType.IsAssignableFrom(type))
{
var instance = (IAfterLogin)Activator.CreateInstance(type);
if (role == instance.RoleName)
return instance.Generate();
}
}
return null;
}
}
}

+ 66
- 15
BO/Utils/BillRpc/WeightBillRpc.cs View File

@ -102,19 +102,41 @@ namespace BO.Utils.BillRpc
obj.Set("FarmerDetails", farmerDetils); obj.Set("FarmerDetails", farmerDetils);
var result = RpcFacade.Call<RpcObject>(method, obj); var result = RpcFacade.Call<RpcObject>(method, obj);
bo.ID = result.Get<long>("ID");
if (bo.ID == 0)
bo.ID = result.Get<long>("ID");
var detailReturns = result.Get<List<RpcObject>>("DetailBack"); var detailReturns = result.Get<List<RpcObject>>("DetailBack");
var rDetails = detailReturns[0].Get<List<RpcObject>>("DetailBack");
foreach (var item in rDetails)
{
var idx = Convert.ToInt32(item.Get<string>("Flag"));
bo.Details.First(x => x.Index == idx).ID = item.Get<long>("ID");
}
var rFarmerDetails = detailReturns[1].Get<List<RpcObject>>("DetailBack");
foreach (var item in rFarmerDetails)
foreach (var d in detailReturns)
{ {
var idx = Convert.ToInt32(item.Get<string>("Flag"));
bo.FarmerDetails.First(x => x.Index == idx).ID = item.Get<long>("ID");
var dFlag = d.Get<string>("Flag");
switch (dFlag)
{
case "Details":
var rdetails = d.Get<List<RpcObject>>("DetailBack");
foreach (var rd in rdetails)
{
var idx = Convert.ToInt32(rd.Get<string>("Flag"));
var first = bo.Details.First(x => x.Index == idx);
if (first.ID == 0)
{
first.ID = rd.Get<long>("ID");
first.WeightBill_ID = bo.ID;
}
}
break;
case "FarmerDetails":
var rfarmerDetails = d.Get<List<RpcObject>>("DetailBack");
foreach (var rd in rfarmerDetails)
{
var idx = Convert.ToInt32(rd.Get<string>("Flag"));
var first = bo.FarmerDetails.First(x => x.Index == idx);
if (first.ID == 0)
{
first.ID = rd.Get<long>("ID");
first.WeightBill_ID = bo.ID;
}
}
break;
}
} }
return true; return true;
@ -212,9 +234,19 @@ namespace BO.Utils.BillRpc
{ {
var entity = new WeightBill(); var entity = new WeightBill();
result.Add(entity); result.Add(entity);
entity.ID = obj.Get<long>("ID");
entity.B3ID = obj.Get<long?>("B3ID");
entity.Supplier_Name = obj.Get<string>("Supplier_Name");
var bill = obj.Get<RpcObject>("Bill");
entity.ID = bill.Get<long>("ID");
entity.B3ID = bill.Get<long?>("B3ID");
entity.Supplier_Name = bill.Get<string>("Supplier_Name");
entity.AlreadyHouse = bill.Get<bool>("AlreadyHouse");
var details = obj.Get<List<RpcObject>>("Detail");
foreach (var detail in details)
{
var d = new WeightBill_HouseDetail();
entity.HouseDetails.Add(d);
d.LiveColonyHouse_Name = detail.Get<string>("LiveColonyHouse_Name");
d.Number = detail.Get<int?>("Number");
}
} }
return result; return result;
} }
@ -223,9 +255,10 @@ namespace BO.Utils.BillRpc
{ {
const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/WeightBillRpc/InsertWeightBillHouseDetail"; const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/WeightBillRpc/InsertWeightBillHouseDetail";
var obj = new RpcObject("/MainSystem/B3ClientService/BO/WeightBill"); var obj = new RpcObject("/MainSystem/B3ClientService/BO/WeightBill");
obj.Set("ID", bo.ID);
obj.Set("HogGrade_ID", bo.HogGrade_ID); obj.Set("HogGrade_ID", bo.HogGrade_ID);
obj.Set("HogGrade_Name", bo.HogGrade_Name); obj.Set("HogGrade_Name", bo.HogGrade_Name);
obj.Set("AlreadyHouse", bo.AlreadyHouse);
obj.Set("Inspector_ID", ButcherAppContext.Context.UserConfig.Employee_ID); obj.Set("Inspector_ID", ButcherAppContext.Context.UserConfig.Employee_ID);
obj.Set("Inspector_Name", ButcherAppContext.Context.UserConfig.Employee_Name); obj.Set("Inspector_Name", ButcherAppContext.Context.UserConfig.Employee_Name);
@ -269,5 +302,23 @@ namespace BO.Utils.BillRpc
const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/WeightBillRpc/GetHouseDetailTotalNumber"; const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/WeightBillRpc/GetHouseDetailTotalNumber";
return RpcFacade.Call<int>(method, date); return RpcFacade.Call<int>(method, date);
} }
public static List<Tuple<long?, long?>> SyncBillB3Ids(List<long?> ids)
{
const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/WeightBillRpc/SyncBillB3Ids";
return RpcFacade.Call<List<Tuple<long?, long?>>>(method, ids.ToArray());
}
public static List<Tuple<long?, long?>> SyncWeightDetailB3Ids(List<long?> ids)
{
const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/WeightBillRpc/SyncWeightDetailB3Ids";
return RpcFacade.Call<List<Tuple<long?, long?>>>(method, ids);
}
public static List<Tuple<long?, long?>> SyncFarmerDetailB3Ids(List<long?> ids)
{
const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/WeightBillRpc/SyncFarmerDetailB3Ids";
return RpcFacade.Call<List<Tuple<long?, long?>>>(method, ids);
}
} }
} }

+ 3
- 2
BO/Utils/LoginRpcUtil.cs View File

@ -25,10 +25,10 @@ namespace BO.Utils
return string.Empty; return string.Empty;
} }
public static void FillUserEmpInfo(string name,LoginUserInfo userInfo)
public static void FillUserEmpInfo(string name, LoginUserInfo userInfo)
{ {
const string wpfUserMethod = "/MainSystem/B3ClientService/Rpcs/UserInfoRpc/GetUserEmpInfo"; const string wpfUserMethod = "/MainSystem/B3ClientService/Rpcs/UserInfoRpc/GetUserEmpInfo";
var obj= RpcFacade.Call<RpcObject>(wpfUserMethod, name);
var obj = RpcFacade.Call<RpcObject>(wpfUserMethod, name);
if (obj != null) if (obj != null)
{ {
userInfo.ID = obj.Get<long>("User_ID"); userInfo.ID = obj.Get<long>("User_ID");
@ -40,6 +40,7 @@ namespace BO.Utils
userInfo.Department_Name = obj.Get<string>("Department_Name"); userInfo.Department_Name = obj.Get<string>("Department_Name");
userInfo.Employee_ID = obj.Get<long>("Employee_ID"); userInfo.Employee_ID = obj.Get<long>("Employee_ID");
userInfo.Employee_Name = obj.Get<string>("Employee_Name"); userInfo.Employee_Name = obj.Get<string>("Employee_Name");
userInfo.Role = obj.Get<string>("Role");
} }
} }
} }


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

@ -25,5 +25,7 @@ namespace BO.Utils
public long Employee_ID { get; set; } public long Employee_ID { get; set; }
public string Employee_Name { get; set; } public string Employee_Name { get; set; }
public string Role { get; set; }
} }
} }

+ 10
- 2
BWP.WinFormControl/WeightControl.Designer.cs View File

@ -1,4 +1,5 @@
namespace BWP.WinFormControl
using System.Windows.Forms;
namespace BWP.WinFormControl
{ {
partial class WeightControl partial class WeightControl
{ {
@ -13,6 +14,12 @@
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
enableWeightBox.CheckState = CheckState.Unchecked;
if (weightSerialPort.IsOpen)
{
weightSerialPort.Close();
weightSerialPort.Dispose();
}
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
@ -59,6 +66,7 @@
// //
// enableWeightBox // enableWeightBox
// //
this.enableWeightBox.AutoCheck = false;
this.enableWeightBox.AutoSize = true; this.enableWeightBox.AutoSize = true;
this.enableWeightBox.Font = new System.Drawing.Font("宋体", 18F); this.enableWeightBox.Font = new System.Drawing.Font("宋体", 18F);
this.enableWeightBox.Location = new System.Drawing.Point(16, 60); this.enableWeightBox.Location = new System.Drawing.Point(16, 60);
@ -67,7 +75,7 @@
this.enableWeightBox.TabIndex = 1; this.enableWeightBox.TabIndex = 1;
this.enableWeightBox.Text = "启用称重"; this.enableWeightBox.Text = "启用称重";
this.enableWeightBox.UseVisualStyleBackColor = true; this.enableWeightBox.UseVisualStyleBackColor = true;
this.enableWeightBox.CheckedChanged += new System.EventHandler(this.enableWeightBox_CheckedChanged);
this.enableWeightBox.Click += new System.EventHandler(this.enableWeightBox_Click);
// //
// WeightControl // WeightControl
// //


+ 60
- 53
BWP.WinFormControl/WeightControl.cs View File

@ -11,7 +11,6 @@ using System.IO.Ports;
using System.Threading; using System.Threading;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using BWP.WinFormControl.WeightDataFormat; using BWP.WinFormControl.WeightDataFormat;
using System.Windows.Forms;
namespace BWP.WinFormControl namespace BWP.WinFormControl
{ {
@ -22,15 +21,17 @@ namespace BWP.WinFormControl
Xk3190A9, Xk3190A9,
Xk3190D10 Xk3190D10
} }
public partial class WeightControl : UserControl public partial class WeightControl : UserControl
{ {
public event EventHandler InitWeightInfo;
#region weight Need #region weight Need
private IDataFormat _dataFormat; private IDataFormat _dataFormat;
private Thread _inQueryThread, _outQueryThread;
private Thread _inQueryThread;
//, _outQueryThread;
readonly StringBuilder _dataStrBuilder = new StringBuilder(); readonly StringBuilder _dataStrBuilder = new StringBuilder();
readonly ConcurrentQueue<string> _dataQueue = new ConcurrentQueue<string>();
//readonly ConcurrentQueue<string> _dataQueue = new ConcurrentQueue<string>();
Form mainForm; Form mainForm;
#endregion #endregion
@ -87,13 +88,14 @@ namespace BWP.WinFormControl
public WeightControl() public WeightControl()
{ {
InitializeComponent(); InitializeComponent();
Control.CheckForIllegalCrossThreadCalls = false;
} }
private void OpenSerialPort() private void OpenSerialPort()
{ {
if (!inited) if (!inited)
throw new Exception("Com口没有实例化,请先调用InitSerialPort"); throw new Exception("Com口没有实例化,请先调用InitSerialPort");
Thread.Sleep(10);
// 打开串口 // 打开串口
if (!weightSerialPort.IsOpen) if (!weightSerialPort.IsOpen)
{ {
@ -118,15 +120,17 @@ namespace BWP.WinFormControl
void ReadData() void ReadData()
{ {
_inQueryThread = new Thread(InQuery); _inQueryThread = new Thread(InQuery);
//_inQueryThread.IsBackground = true;
_inQueryThread.Start(); _inQueryThread.Start();
_outQueryThread = new Thread(OutQuery);
_outQueryThread.Start();
//_outQueryThread = new Thread(OutQuery);
//_outQueryThread.IsBackground = true;
//_outQueryThread.Start();
} }
private void InQuery() private void InQuery()
{ {
while (enableWeightBox.Checked)
while (enableWeightBox.CheckState == CheckState.Checked)
{ {
int availableCount = weightSerialPort.BytesToRead; int availableCount = weightSerialPort.BytesToRead;
if (availableCount == 0) if (availableCount == 0)
@ -149,7 +153,14 @@ namespace BWP.WinFormControl
else if (c == _dataFormat.Endchar || _dataStrBuilder.Length > _dataFormat.Bufsize) else if (c == _dataFormat.Endchar || _dataStrBuilder.Length > _dataFormat.Bufsize)
{ {
_dataStrBuilder.Append(c); _dataStrBuilder.Append(c);
_dataQueue.Enqueue(_dataStrBuilder.ToString());
bool isStatic;
string str;
if (_dataFormat.ParseAscii(_dataStrBuilder.ToString(), out str, out isStatic))
{
Value = decimal.Parse(str);
break;
}
// _dataQueue.Enqueue(_dataStrBuilder.ToString());
_dataStrBuilder.Clear(); _dataStrBuilder.Clear();
} }
else else
@ -160,36 +171,36 @@ namespace BWP.WinFormControl
} }
} }
private void OutQuery()
{
while (enableWeightBox.Checked)
{
try
{
bool isStatic;
string str;
//private void OutQuery()
//{
// while (enableWeightBox.CheckState == CheckState.Checked)
// {
// try
// {
// bool isStatic;
// string str;
string subStr;
// string subStr;
if (!_dataQueue.TryDequeue(out subStr))
{
Thread.Sleep(1);
continue;
}
// 解析接受的端口数据
if (_dataFormat.ParseAscii(subStr, out str, out isStatic))
{
Value = decimal.Parse(str);
}
}
catch (Exception)
{
Thread.Sleep(1000);
continue;
}
Thread.Sleep(1);
}
}
// if (!_dataQueue.TryDequeue(out subStr))
// {
// Thread.Sleep(1);
// continue;
// }
// // 解析接受的端口数据
// if (_dataFormat.ParseAscii(subStr, out str, out isStatic))
// {
// Value = decimal.Parse(str);
// }
// }
// catch (Exception)
// {
// Thread.Sleep(1000);
// continue;
// }
// Thread.Sleep(1);
// }
//}
void InitWeightType() void InitWeightType()
{ {
@ -216,38 +227,33 @@ namespace BWP.WinFormControl
{ {
mainForm.FormClosed -= MainFrom_FormClosed; mainForm.FormClosed -= MainFrom_FormClosed;
Thread.Sleep(10); Thread.Sleep(10);
if (weightSerialPort.IsOpen)
{
weightSerialPort.Close();
}
if (_inQueryThread.IsAlive) if (_inQueryThread.IsAlive)
{ {
_inQueryThread.Abort(); _inQueryThread.Abort();
} }
if (_outQueryThread.IsAlive)
{
_outQueryThread.Abort();
}
//if (_outQueryThread.IsAlive)
//{
// _outQueryThread.Abort();
//}
weightSerialPort.Close();
Value = 0; Value = 0;
} }
private void MainFrom_FormClosed(object sender, FormClosedEventArgs e) private void MainFrom_FormClosed(object sender, FormClosedEventArgs e)
{ {
if (!enableWeightBox.Checked)
if (enableWeightBox.CheckState == CheckState.Checked)
return; return;
DisableWeight(); DisableWeight();
} }
private void enableWeightBox_CheckedChanged(object sender, EventArgs e)
private void enableWeightBox_Click(object sender, EventArgs e)
{ {
if (InitWeightInfo == null)
throw new Exception("InitWeightInfo是用来实例化称参数的,请给此委托赋值并在其中实例化称参数");
InitWeightInfo(this, EventArgs.Empty);
if (!inited) if (!inited)
{
enableWeightBox.Checked = false;
throw new Exception("Com口没有实例化,请先调用InitSerialPort"); throw new Exception("Com口没有实例化,请先调用InitSerialPort");
}
if (enableWeightBox.Checked)
if (!enableWeightBox.Checked)
{ {
InitWeightType(); InitWeightType();
OpenSerialPort(); OpenSerialPort();
@ -255,6 +261,7 @@ namespace BWP.WinFormControl
} }
else else
DisableWeight(); DisableWeight();
enableWeightBox.CheckState = enableWeightBox.Checked ? CheckState.Unchecked : CheckState.Checked;
} }
} }
} }

+ 0
- 50
ButcherManageClient/AfterLoginUtil.cs View File

@ -1,50 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ButcherManageClient
{
public interface IAfterLogin
{
string RoleName { get; }
Form Generate();
}
internal static class AfterLoginUtil
{
static List<Tuple<string, string>> roleToAssemblies = new List<Tuple<string, string>> {
new Tuple<string,string>("1测试",@"C:\B3Service\src\B3ButcherManageClient\ButcherOrder\bin\Debug\ButcherOrder"),
new Tuple<string,string>("_2",@"C:\B3Service\src\B3ButcherManageClient\ButcherWeight\bin\Debug\ButcherWeight"),
new Tuple<string,string>("_1",@"C:\B3Service\src\B3ButcherManageClient\QualityAndOrder\bin\Debug\QualityAndOrder"),
new Tuple<string,string>("小新",""),
};
public static Form CreateForm(string role)
{
var first = roleToAssemblies.FirstOrDefault(x => x.Item1 == role);
if (first == null)
throw new Exception("未注册的角色");
//var filePath = Path.Combine(Application.StartupPath, string.Format("{0}.dll", first.Item2));
var filePath = string.Format("{0}.dll", first.Item2);
if (!File.Exists(filePath))
throw new Exception("相关模块不存在");
var formType = typeof(IAfterLogin);
foreach (var type in Assembly.LoadFile(filePath).GetTypes())
{
if (formType.IsAssignableFrom(type))
{
var instance = (IAfterLogin)Activator.CreateInstance(type);
if (role == instance.RoleName)
return instance.Generate();
}
}
return null;
}
}
}

+ 0
- 1
ButcherManageClient/ButcherManageClient.csproj View File

@ -60,7 +60,6 @@
<Reference Include="WindowsBase" /> <Reference Include="WindowsBase" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AfterLoginUtil.cs" />
<Compile Include="Login.cs"> <Compile Include="Login.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>


+ 1
- 1
ButcherManageClient/Login.cs View File

@ -51,7 +51,7 @@ namespace ButcherManageClient
await Task.Factory.StartNew(() => RpcFacade.Login(username, pwd)); await Task.Factory.StartNew(() => RpcFacade.Login(username, pwd));
LoginRpcUtil.FillUserEmpInfo(username, ButcherAppContext.Context.UserConfig); LoginRpcUtil.FillUserEmpInfo(username, ButcherAppContext.Context.UserConfig);
ButcherAppContext.Context.Save(); ButcherAppContext.Context.Save();
var form = AfterLoginUtil.CreateForm("_1");
var form = AfterLoginUtil.CreateForm(ButcherAppContext.Context.UserConfig.Role);
if (form == null) if (form == null)
throw new Exception("权限不符"); throw new Exception("权限不符");
form.FormClosing += delegate { SubFormClosing(); }; form.FormClosing += delegate { SubFormClosing(); };


+ 0
- 4
ButcherOrder/ButcherOrder.csproj View File

@ -64,10 +64,6 @@
<Project>{8968f14a-c7c7-4751-96ce-b114fbfd65ef}</Project> <Project>{8968f14a-c7c7-4751-96ce-b114fbfd65ef}</Project>
<Name>BO</Name> <Name>BO</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\ButcherManageClient\ButcherManageClient.csproj">
<Project>{59b13436-4884-4533-9c7e-80e8580cbf55}</Project>
<Name>ButcherManageClient</Name>
</ProjectReference>
<ProjectReference Include="..\BWP.WinFormControl\BWP.WinFormControl.csproj"> <ProjectReference Include="..\BWP.WinFormControl\BWP.WinFormControl.csproj">
<Project>{A782B23E-BE6D-4F51-B5CB-5CD259BA97CC}</Project> <Project>{A782B23E-BE6D-4F51-B5CB-5CD259BA97CC}</Project>
<Name>BWP.WinFormControl</Name> <Name>BWP.WinFormControl</Name>


+ 1
- 7
ButcherOrder/ButcherOrderForm.cs View File

@ -1,12 +1,6 @@
using ButcherManageClient;
using BO.Utils;
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace ButcherOrder namespace ButcherOrder


+ 10
- 4
ButcherWeight/ButcherWeight.csproj View File

@ -58,28 +58,34 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WeightConfig.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="WeightConfig.Designer.cs">
<DependentUpon>WeightConfig.cs</DependentUpon>
</Compile>
<Compile Include="WeightForm.cs"> <Compile Include="WeightForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="WeightForm.Designer.cs"> <Compile Include="WeightForm.Designer.cs">
<DependentUpon>WeightForm.cs</DependentUpon> <DependentUpon>WeightForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="WeightContext.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\BO\BO.csproj"> <ProjectReference Include="..\BO\BO.csproj">
<Project>{8968f14a-c7c7-4751-96ce-b114fbfd65ef}</Project> <Project>{8968f14a-c7c7-4751-96ce-b114fbfd65ef}</Project>
<Name>BO</Name> <Name>BO</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\ButcherManageClient\ButcherManageClient.csproj">
<Project>{59b13436-4884-4533-9c7e-80e8580cbf55}</Project>
<Name>ButcherManageClient</Name>
</ProjectReference>
<ProjectReference Include="..\BWP.WinFormControl\BWP.WinFormControl.csproj"> <ProjectReference Include="..\BWP.WinFormControl\BWP.WinFormControl.csproj">
<Project>{A782B23E-BE6D-4F51-B5CB-5CD259BA97CC}</Project> <Project>{A782B23E-BE6D-4F51-B5CB-5CD259BA97CC}</Project>
<Name>BWP.WinFormControl</Name> <Name>BWP.WinFormControl</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="WeightConfig.resx">
<DependentUpon>WeightConfig.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="WeightForm.resx"> <EmbeddedResource Include="WeightForm.resx">
<DependentUpon>WeightForm.cs</DependentUpon> <DependentUpon>WeightForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>


+ 203
- 0
ButcherWeight/WeightConfig.Designer.cs View File

@ -0,0 +1,203 @@
namespace ButcherWeight
{
partial class WeightConfig
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.weightSet = new System.Windows.Forms.ComboBox();
this.comSet = new System.Windows.Forms.ComboBox();
this.rateSet = new System.Windows.Forms.ComboBox();
this.bitSet = new System.Windows.Forms.ComboBox();
this.saveBtn = new System.Windows.Forms.Button();
this.closeBtn = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
this.format = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 15F);
this.label1.Location = new System.Drawing.Point(39, 30);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(89, 20);
this.label1.TabIndex = 0;
this.label1.Text = "称型号:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 15F);
this.label2.Location = new System.Drawing.Point(39, 78);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(89, 20);
this.label2.TabIndex = 1;
this.label2.Text = "端口号:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 15F);
this.label3.Location = new System.Drawing.Point(39, 128);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(89, 20);
this.label3.TabIndex = 2;
this.label3.Text = "波特率:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("宋体", 15F);
this.label4.Location = new System.Drawing.Point(39, 180);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(89, 20);
this.label4.TabIndex = 3;
this.label4.Text = "数据位:";
//
// weightSet
//
this.weightSet.Font = new System.Drawing.Font("宋体", 15F);
this.weightSet.FormattingEnabled = true;
this.weightSet.Location = new System.Drawing.Point(161, 27);
this.weightSet.Name = "weightSet";
this.weightSet.Size = new System.Drawing.Size(121, 28);
this.weightSet.TabIndex = 4;
//
// comSet
//
this.comSet.Font = new System.Drawing.Font("宋体", 15F);
this.comSet.FormattingEnabled = true;
this.comSet.Location = new System.Drawing.Point(161, 75);
this.comSet.Name = "comSet";
this.comSet.Size = new System.Drawing.Size(121, 28);
this.comSet.TabIndex = 5;
//
// rateSet
//
this.rateSet.Font = new System.Drawing.Font("宋体", 15F);
this.rateSet.FormattingEnabled = true;
this.rateSet.Location = new System.Drawing.Point(161, 125);
this.rateSet.Name = "rateSet";
this.rateSet.Size = new System.Drawing.Size(121, 28);
this.rateSet.TabIndex = 5;
//
// bitSet
//
this.bitSet.Font = new System.Drawing.Font("宋体", 15F);
this.bitSet.FormattingEnabled = true;
this.bitSet.Location = new System.Drawing.Point(161, 177);
this.bitSet.Name = "bitSet";
this.bitSet.Size = new System.Drawing.Size(121, 28);
this.bitSet.TabIndex = 5;
//
// saveBtn
//
this.saveBtn.Font = new System.Drawing.Font("宋体", 15F);
this.saveBtn.Location = new System.Drawing.Point(71, 280);
this.saveBtn.Name = "saveBtn";
this.saveBtn.Size = new System.Drawing.Size(75, 35);
this.saveBtn.TabIndex = 6;
this.saveBtn.Text = "保存";
this.saveBtn.UseVisualStyleBackColor = true;
this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click);
//
// closeBtn
//
this.closeBtn.Font = new System.Drawing.Font("宋体", 15F);
this.closeBtn.Location = new System.Drawing.Point(177, 280);
this.closeBtn.Name = "closeBtn";
this.closeBtn.Size = new System.Drawing.Size(75, 35);
this.closeBtn.TabIndex = 7;
this.closeBtn.Text = "关闭";
this.closeBtn.UseVisualStyleBackColor = true;
this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("宋体", 15F);
this.label5.Location = new System.Drawing.Point(39, 230);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(109, 20);
this.label5.TabIndex = 8;
this.label5.Text = "显示格式:";
//
// format
//
this.format.Font = new System.Drawing.Font("宋体", 14F);
this.format.Location = new System.Drawing.Point(161, 228);
this.format.Name = "format";
this.format.Size = new System.Drawing.Size(121, 29);
this.format.TabIndex = 9;
//
// WeightConfig
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(354, 343);
this.Controls.Add(this.format);
this.Controls.Add(this.label5);
this.Controls.Add(this.closeBtn);
this.Controls.Add(this.saveBtn);
this.Controls.Add(this.bitSet);
this.Controls.Add(this.rateSet);
this.Controls.Add(this.comSet);
this.Controls.Add(this.weightSet);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "WeightConfig";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "称设置";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox weightSet;
private System.Windows.Forms.ComboBox comSet;
private System.Windows.Forms.ComboBox rateSet;
private System.Windows.Forms.ComboBox bitSet;
private System.Windows.Forms.Button saveBtn;
private System.Windows.Forms.Button closeBtn;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox format;
}
}

+ 64
- 0
ButcherWeight/WeightConfig.cs View File

@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ButcherWeight
{
public partial class WeightConfig : Form
{
List<string> weight = new List<string> { "IND560", "Xk3124", "Xk3190A9", "Xk3190D10" };
List<string> com = new List<string> { "COM1", "COM2", "COM3", "COM4", "COM5" };
List<string> rate = new List<string> { "4800", "7200", "9600" };
List<string> bit = new List<string> { "5", "6", "7", "8" };
public WeightConfig()
{
InitializeComponent();
weightSet.DataSource = weight;
comSet.DataSource = com;
rateSet.DataSource = rate;
bitSet.DataSource = bit;
if (!string.IsNullOrEmpty(WeightContext.Config.WeightSet))
weightSet.SelectedIndex = weight.IndexOf(WeightContext.Config.WeightSet);
else
weightSet.SelectedIndex = 0;
if (!string.IsNullOrEmpty(WeightContext.Config.ComSet))
comSet.SelectedIndex = com.IndexOf(WeightContext.Config.ComSet);
else
comSet.SelectedIndex = 0;
if (WeightContext.Config.RateSet.HasValue)
rateSet.SelectedIndex = rate.IndexOf(WeightContext.Config.RateSet.ToString());
else
rateSet.SelectedIndex = 2;
if (WeightContext.Config.BitSet.HasValue)
bitSet.SelectedIndex = bit.IndexOf(WeightContext.Config.BitSet.ToString());
else
bitSet.SelectedIndex = 3;
if (string.IsNullOrEmpty(WeightContext.Config.Format))
format.Text = "0.00";
else
format.Text = WeightContext.Config.Format;
}
private void saveBtn_Click(object sender, EventArgs e)
{
WeightContext.Config.WeightSet = weight[this.weightSet.SelectedIndex];
WeightContext.Config.ComSet = com[this.comSet.SelectedIndex];
WeightContext.Config.RateSet = int.Parse(rate[this.rateSet.SelectedIndex]);
WeightContext.Config.BitSet = int.Parse(bit[this.bitSet.SelectedIndex]);
WeightContext.Config.Format = format.Text;
WeightContext.Save();
MessageBox.Show("保存成功!");
}
private void closeBtn_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

+ 120
- 0
ButcherWeight/WeightConfig.resx View File

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

+ 78
- 0
ButcherWeight/WeightContext.cs View File

@ -0,0 +1,78 @@
using BO.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ButcherWeight
{
public static class WeightContext
{
//#if relase
// private static string loginConfigPath = Application.StartupPath + "\\WeightSetting.xml";
//#endif
//#if debug
private static string loginConfigPath = @"C:\B3Service\src\B3ButcherManageClient\ButcherManageClient\bin\Debug\WeightSetting.xml";
//#endif
private static WeightSetting _config;
public static WeightSetting Config
{
get
{
if (_config == null)
_config = CreateConfig();
return _config;
}
}
static WeightSetting CreateConfig()
{
var config = new WeightSetting();
if (!File.Exists(loginConfigPath))
{
XmlUtil.SerializerObjToFile(config, loginConfigPath);
}
else
config = XmlUtil.DeserializeFromFile<WeightSetting>(loginConfigPath);
return config;
}
public static void Save()
{
if (string.IsNullOrEmpty(_config.WeightSet))
throw new Exception("请选择称型号");
if (string.IsNullOrEmpty(_config.ComSet))
throw new Exception("请选择Com口");
if (_config.RateSet==null)
throw new Exception("请选择波特率");
if (_config.BitSet == null)
throw new Exception("请选择数据位");
if (string.IsNullOrEmpty(_config.Format))
throw new Exception("请填写显示格式");
try
{
string.Format("{0:" + _config.Format + "}", 1);
}
catch (Exception ex)
{
throw new Exception("显示格式填写错误\n" + ex.Message);
}
XmlUtil.SerializerObjToFile(_config, loginConfigPath);
}
}
public class WeightSetting
{
public string WeightSet{get;set;}
public string ComSet{get;set;}
public int? RateSet{get;set;}
public int? BitSet{get;set;}
public string Format{get;set;}
}
}

+ 91
- 75
ButcherWeight/WeightForm.Designer.cs View File

@ -13,6 +13,7 @@
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
mainIsRun = false;
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
@ -28,22 +29,23 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle32 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle33 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle35 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle36 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle37 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle38 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle39 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle40 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle41 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle42 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle43 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle44 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle45 = new System.Windows.Forms.DataGridViewCellStyle();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.weightSet = new System.Windows.Forms.Button();
this.weightControl = new BWP.WinFormControl.WeightControl(); this.weightControl = new BWP.WinFormControl.WeightControl();
this.exitBtn = new System.Windows.Forms.Button(); this.exitBtn = new System.Windows.Forms.Button();
this.deleteBtn = new System.Windows.Forms.Button(); this.deleteBtn = new System.Windows.Forms.Button();
@ -152,6 +154,7 @@
// panel1 // panel1
// //
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.weightSet);
this.panel1.Controls.Add(this.weightControl); this.panel1.Controls.Add(this.weightControl);
this.panel1.Controls.Add(this.exitBtn); this.panel1.Controls.Add(this.exitBtn);
this.panel1.Controls.Add(this.deleteBtn); this.panel1.Controls.Add(this.deleteBtn);
@ -165,6 +168,17 @@
this.panel1.Size = new System.Drawing.Size(1252, 95); this.panel1.Size = new System.Drawing.Size(1252, 95);
this.panel1.TabIndex = 1; this.panel1.TabIndex = 1;
// //
// weightSet
//
this.weightSet.Font = new System.Drawing.Font("宋体", 15F);
this.weightSet.Location = new System.Drawing.Point(1146, 0);
this.weightSet.Name = "weightSet";
this.weightSet.Size = new System.Drawing.Size(101, 59);
this.weightSet.TabIndex = 10;
this.weightSet.Text = "称设置";
this.weightSet.UseVisualStyleBackColor = true;
this.weightSet.Click += new System.EventHandler(this.weightSet_Click);
//
// weightControl // weightControl
// //
this.weightControl.Location = new System.Drawing.Point(0, 0); this.weightControl.Location = new System.Drawing.Point(0, 0);
@ -194,6 +208,7 @@
this.deleteBtn.TabIndex = 5; this.deleteBtn.TabIndex = 5;
this.deleteBtn.Text = "删除"; this.deleteBtn.Text = "删除";
this.deleteBtn.UseVisualStyleBackColor = true; this.deleteBtn.UseVisualStyleBackColor = true;
this.deleteBtn.Click += new System.EventHandler(this.deleteBtn_Click);
// //
// printBtn // printBtn
// //
@ -674,17 +689,17 @@
this.farmerGrid.AllowUserToAddRows = false; this.farmerGrid.AllowUserToAddRows = false;
this.farmerGrid.AllowUserToResizeColumns = false; this.farmerGrid.AllowUserToResizeColumns = false;
this.farmerGrid.AllowUserToResizeRows = false; this.farmerGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.farmerGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle31.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.farmerGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle31;
this.farmerGrid.BackgroundColor = System.Drawing.Color.White; this.farmerGrid.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.farmerGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle32.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle32.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle32.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle32.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle32.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle32.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.farmerGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle32;
this.farmerGrid.ColumnHeadersHeight = 24; this.farmerGrid.ColumnHeadersHeight = 24;
this.farmerGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.farmerGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.farmerGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.farmerGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@ -699,8 +714,8 @@
this.farmerGrid.MultiSelect = false; this.farmerGrid.MultiSelect = false;
this.farmerGrid.Name = "farmerGrid"; this.farmerGrid.Name = "farmerGrid";
this.farmerGrid.RowHeadersVisible = false; this.farmerGrid.RowHeadersVisible = false;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.farmerGrid.RowsDefaultCellStyle = dataGridViewCellStyle3;
dataGridViewCellStyle33.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.farmerGrid.RowsDefaultCellStyle = dataGridViewCellStyle33;
this.farmerGrid.RowTemplate.Height = 23; this.farmerGrid.RowTemplate.Height = 23;
this.farmerGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.farmerGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.farmerGrid.Size = new System.Drawing.Size(400, 112); this.farmerGrid.Size = new System.Drawing.Size(400, 112);
@ -783,17 +798,17 @@
this.weightGrid.AllowUserToAddRows = false; this.weightGrid.AllowUserToAddRows = false;
this.weightGrid.AllowUserToResizeColumns = false; this.weightGrid.AllowUserToResizeColumns = false;
this.weightGrid.AllowUserToResizeRows = false; this.weightGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.weightGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4;
dataGridViewCellStyle34.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.weightGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle34;
this.weightGrid.BackgroundColor = System.Drawing.Color.White; this.weightGrid.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.weightGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle35.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle35.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle35.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle35.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle35.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle35.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle35.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.weightGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle35;
this.weightGrid.ColumnHeadersHeight = 24; this.weightGrid.ColumnHeadersHeight = 24;
this.weightGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.weightGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.weightGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.weightGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@ -809,8 +824,8 @@
this.weightGrid.MultiSelect = false; this.weightGrid.MultiSelect = false;
this.weightGrid.Name = "weightGrid"; this.weightGrid.Name = "weightGrid";
this.weightGrid.RowHeadersVisible = false; this.weightGrid.RowHeadersVisible = false;
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.weightGrid.RowsDefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle36.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.weightGrid.RowsDefaultCellStyle = dataGridViewCellStyle36;
this.weightGrid.RowTemplate.Height = 23; this.weightGrid.RowTemplate.Height = 23;
this.weightGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.weightGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.weightGrid.Size = new System.Drawing.Size(400, 90); this.weightGrid.Size = new System.Drawing.Size(400, 90);
@ -891,17 +906,17 @@
this.houseGird.AllowUserToDeleteRows = false; this.houseGird.AllowUserToDeleteRows = false;
this.houseGird.AllowUserToResizeColumns = false; this.houseGird.AllowUserToResizeColumns = false;
this.houseGird.AllowUserToResizeRows = false; this.houseGird.AllowUserToResizeRows = false;
dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.houseGird.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7;
dataGridViewCellStyle37.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.houseGird.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle37;
this.houseGird.BackgroundColor = System.Drawing.Color.White; this.houseGird.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.houseGird.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8;
dataGridViewCellStyle38.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle38.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle38.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle38.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle38.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle38.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle38.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.houseGird.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle38;
this.houseGird.ColumnHeadersHeight = 24; this.houseGird.ColumnHeadersHeight = 24;
this.houseGird.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.houseGird.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.houseGird.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.houseGird.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@ -916,8 +931,8 @@
this.houseGird.MultiSelect = false; this.houseGird.MultiSelect = false;
this.houseGird.Name = "houseGird"; this.houseGird.Name = "houseGird";
this.houseGird.RowHeadersVisible = false; this.houseGird.RowHeadersVisible = false;
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.houseGird.RowsDefaultCellStyle = dataGridViewCellStyle9;
dataGridViewCellStyle39.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.houseGird.RowsDefaultCellStyle = dataGridViewCellStyle39;
this.houseGird.RowTemplate.Height = 23; this.houseGird.RowTemplate.Height = 23;
this.houseGird.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.houseGird.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.houseGird.Size = new System.Drawing.Size(400, 90); this.houseGird.Size = new System.Drawing.Size(400, 90);
@ -980,17 +995,17 @@
this.abnormalGrid.AllowUserToDeleteRows = false; this.abnormalGrid.AllowUserToDeleteRows = false;
this.abnormalGrid.AllowUserToResizeColumns = false; this.abnormalGrid.AllowUserToResizeColumns = false;
this.abnormalGrid.AllowUserToResizeRows = false; this.abnormalGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle10.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.abnormalGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle10;
dataGridViewCellStyle40.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.abnormalGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle40;
this.abnormalGrid.BackgroundColor = System.Drawing.Color.White; this.abnormalGrid.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle11.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.abnormalGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11;
dataGridViewCellStyle41.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle41.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle41.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle41.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle41.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle41.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle41.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.abnormalGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle41;
this.abnormalGrid.ColumnHeadersHeight = 24; this.abnormalGrid.ColumnHeadersHeight = 24;
this.abnormalGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.abnormalGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.abnormalGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.abnormalGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@ -1006,8 +1021,8 @@
this.abnormalGrid.MultiSelect = false; this.abnormalGrid.MultiSelect = false;
this.abnormalGrid.Name = "abnormalGrid"; this.abnormalGrid.Name = "abnormalGrid";
this.abnormalGrid.RowHeadersVisible = false; this.abnormalGrid.RowHeadersVisible = false;
dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.abnormalGrid.RowsDefaultCellStyle = dataGridViewCellStyle12;
dataGridViewCellStyle42.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.abnormalGrid.RowsDefaultCellStyle = dataGridViewCellStyle42;
this.abnormalGrid.RowTemplate.Height = 23; this.abnormalGrid.RowTemplate.Height = 23;
this.abnormalGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.abnormalGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.abnormalGrid.Size = new System.Drawing.Size(400, 237); this.abnormalGrid.Size = new System.Drawing.Size(400, 237);
@ -1076,17 +1091,17 @@
this.billGrid.AllowUserToDeleteRows = false; this.billGrid.AllowUserToDeleteRows = false;
this.billGrid.AllowUserToResizeColumns = false; this.billGrid.AllowUserToResizeColumns = false;
this.billGrid.AllowUserToResizeRows = false; this.billGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle13.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.billGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13;
dataGridViewCellStyle43.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.billGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle43;
this.billGrid.BackgroundColor = System.Drawing.Color.White; this.billGrid.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle14.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.billGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14;
dataGridViewCellStyle44.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle44.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle44.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle44.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle44.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle44.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle44.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.billGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle44;
this.billGrid.ColumnHeadersHeight = 24; this.billGrid.ColumnHeadersHeight = 24;
this.billGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.billGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.billGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.billGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@ -1105,8 +1120,8 @@
this.billGrid.Name = "billGrid"; this.billGrid.Name = "billGrid";
this.billGrid.ReadOnly = true; this.billGrid.ReadOnly = true;
this.billGrid.RowHeadersVisible = false; this.billGrid.RowHeadersVisible = false;
dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.billGrid.RowsDefaultCellStyle = dataGridViewCellStyle15;
dataGridViewCellStyle45.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.billGrid.RowsDefaultCellStyle = dataGridViewCellStyle45;
this.billGrid.RowTemplate.Height = 23; this.billGrid.RowTemplate.Height = 23;
this.billGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.billGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.billGrid.Size = new System.Drawing.Size(1250, 281); this.billGrid.Size = new System.Drawing.Size(1250, 281);
@ -1358,5 +1373,6 @@
private System.Windows.Forms.Button deleteBtn; private System.Windows.Forms.Button deleteBtn;
private System.Windows.Forms.Button printBtn; private System.Windows.Forms.Button printBtn;
private BWP.WinFormControl.WeightControl weightControl; private BWP.WinFormControl.WeightControl weightControl;
private System.Windows.Forms.Button weightSet;
} }
} }

+ 116
- 8
ButcherWeight/WeightForm.cs View File

@ -1,7 +1,6 @@
using BO.BO; using BO.BO;
using BO.Utils; using BO.Utils;
using BO.Utils.BillRpc; using BO.Utils.BillRpc;
using ButcherManageClient;
using BWP.WinFormControl; using BWP.WinFormControl;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -10,6 +9,7 @@ using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
@ -20,7 +20,7 @@ namespace ButcherWeight
#region IAfterLogin Member #region IAfterLogin Member
public string RoleName public string RoleName
{ {
get { return "_11"; }
get { return "过磅员"; }
} }
public Form Generate() public Form Generate()
@ -29,6 +29,9 @@ namespace ButcherWeight
} }
#endregion #endregion
private const int WmUpdDisplayMessage = 0x0500 + 2;
bool mainIsRun = false;
public WeightForm() public WeightForm()
{ {
InitializeComponent(); InitializeComponent();
@ -49,18 +52,106 @@ namespace ButcherWeight
weightGrid.AutoGenerateColumns = false; weightGrid.AutoGenerateColumns = false;
houseGird.AutoGenerateColumns = false; houseGird.AutoGenerateColumns = false;
abnormalGrid.AutoGenerateColumns = false; abnormalGrid.AutoGenerateColumns = false;
weightControl.EnableCheckBox.CheckedChanged += delegate
weightControl.InitWeightInfo += WeightControlInitWeightInfo;
weightControl.EnableCheckBox.CheckStateChanged += delegate
{ {
readMaoBtn.Enabled = readPiBtn.Enabled = weightControl.EnableCheckBox.Checked; readMaoBtn.Enabled = readPiBtn.Enabled = weightControl.EnableCheckBox.Checked;
}; };
weightControl.InitSerialPort("COM2", 9600, 8);
weightControl.TypeOfWeight = WeightType.Xk3190A9;
BindWeightBill(); BindWeightBill();
mainIsRun = true;
var syncThread = new Thread(SyncTask) { IsBackground = true };
syncThread.Start();
}
private void SyncTask()
{
while (mainIsRun)
{
bool changed = false;
var ids = dmoList.Where(x => x.B3ID == null).Select(x => (long?)x.ID).ToList();
if (ids.Any())
{
var result = WeightBillRpc.SyncBillB3Ids(ids);
foreach (var item in result)
{
var first = dmoList.FirstOrDefault(x => x.ID == item.Item1);
if (first != null)
{
first.B3ID = item.Item2;
if (!changed)
changed = true;
}
}
if (changed)
{
BindWeightBill();
}
}
var details = new List<WeightBill_Detail>();
var farms = new List<WeightBill_FarmerDetail>();
foreach (var dmo in dmoList)
{
details.AddRange(dmo.Details.Where(x => x.B3ID == null));
farms.AddRange(dmo.FarmerDetails.Where(x => x.B3ID == null));
}
if (details.Any())
{
var dids = details.Select(x => (long?)x.ID).ToList();
var result2 = WeightBillRpc.SyncWeightDetailB3Ids(dids);
foreach (var item in result2)
{
var first = details.FirstOrDefault(x => x.ID == item.Item1);
if (first != null)
{
first.B3ID = item.Item2;
}
}
}
if (farms.Any())
{
var dids = farms.Select(x => (long?)x.ID).ToList();
var result2 = WeightBillRpc.SyncFarmerDetailB3Ids(dids);
foreach (var item in result2)
{
var first = details.FirstOrDefault(x => x.ID == item.Item1);
if (first != null)
{
first.B3ID = item.Item2;
}
}
}
}
}
void WeightControlInitWeightInfo(object sender, EventArgs e)
{
if (weightControl.EnableCheckBox.Checked)
return;
if (WeightContext.Config.RateSet == null)
throw new Exception("请先配置称相关信息");
weightControl.InitSerialPort(WeightContext.Config.ComSet, WeightContext.Config.RateSet.Value, WeightContext.Config.BitSet.Value);
switch (WeightContext.Config.WeightSet)
{
case "IND560":
weightControl.TypeOfWeight = WeightType.IND560;
break;
case "Xk3124":
weightControl.TypeOfWeight = WeightType.Xk3124;
break;
case "Xk3190A9":
weightControl.TypeOfWeight = WeightType.Xk3190A9;
break;
default:
weightControl.TypeOfWeight = WeightType.Xk3190D10;
break;
}
//weightControl.InitWeightInfo -= WeightControlInitWeightInfo;
} }
void BindWeightBill() void BindWeightBill()
{ {
billGrid.DataSource = dmoList.OrderBy(x => x.FinishCreate).ToList();
billGrid.DataSource = dmoList.OrderByDescending(x => x.ID).ToList();
billGrid.Refresh(); billGrid.Refresh();
} }
@ -289,8 +380,10 @@ namespace ButcherWeight
_farmerDetails = Dmo.FarmerDetails.ToList(); _farmerDetails = Dmo.FarmerDetails.ToList();
_details = Dmo.Details.ToList(); _details = Dmo.Details.ToList();
farmerGrid.DataSource = _farmerDetails;
weightGrid.DataSource = _details;
if (_farmerDetails.Any())
farmerGrid.DataSource = _farmerDetails;
if (_details.Any())
weightGrid.DataSource = _details;
} }
void ResetControl() void ResetControl()
@ -323,5 +416,20 @@ namespace ButcherWeight
Dmo = dmoList.First(x => x.ID == id); Dmo = dmoList.First(x => x.ID == id);
AppToUI(); AppToUI();
} }
private void weightSet_Click(object sender, EventArgs e)
{
new WeightConfig().ShowDialog();
}
private void deleteBtn_Click(object sender, EventArgs e)
{
if (Dmo.ID != 0)
WeightBillRpc.Delete(Dmo.ID);
dmoList.Remove(Dmo);
BindWeightBill();
createBtn_Click(sender, e);
MessageBox.Show("删除成功!");
}
} }
} }

+ 0
- 4
QualityAndOrder/QualityAndOrder.csproj View File

@ -61,10 +61,6 @@
<Project>{8968f14a-c7c7-4751-96ce-b114fbfd65ef}</Project> <Project>{8968f14a-c7c7-4751-96ce-b114fbfd65ef}</Project>
<Name>BO</Name> <Name>BO</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\ButcherManageClient\ButcherManageClient.csproj">
<Project>{59b13436-4884-4533-9c7e-80e8580cbf55}</Project>
<Name>ButcherManageClient</Name>
</ProjectReference>
<ProjectReference Include="..\BWP.WinFormControl\BWP.WinFormControl.csproj"> <ProjectReference Include="..\BWP.WinFormControl\BWP.WinFormControl.csproj">
<Project>{a782b23e-be6d-4f51-b5cb-5cd259ba97cc}</Project> <Project>{a782b23e-be6d-4f51-b5cb-5cd259ba97cc}</Project>
<Name>BWP.WinFormControl</Name> <Name>BWP.WinFormControl</Name>


+ 58
- 58
QualityAndOrder/QualityOrderForm.Designer.cs View File

@ -69,6 +69,12 @@
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.keyBoardPanel = new System.Windows.Forms.FlowLayoutPanel(); this.keyBoardPanel = new System.Windows.Forms.FlowLayoutPanel();
this.weightBillGrid = new BWP.WinFormControl.UDataGridView(); this.weightBillGrid = new BWP.WinFormControl.UDataGridView();
this.W_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.W_AlreadyHouse = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.W_B3ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.W_Supplier_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.W_HouseNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.W_HouseNames = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.syncBtn = new System.Windows.Forms.Button(); this.syncBtn = new System.Windows.Forms.Button();
this.testTimeInput = new BWP.WinFormControl.UDatePicker(); this.testTimeInput = new BWP.WinFormControl.UDatePicker();
this.label20 = new System.Windows.Forms.Label(); this.label20 = new System.Windows.Forms.Label();
@ -96,12 +102,6 @@
this.tab2SyncBtn = new System.Windows.Forms.Button(); this.tab2SyncBtn = new System.Windows.Forms.Button();
this.tab2DateSelect = new BWP.WinFormControl.UDatePicker(); this.tab2DateSelect = new BWP.WinFormControl.UDatePicker();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.W_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.W_B3ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.W_Supplier_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.W_HouseNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.W_HouseNames = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.W_FinishCreate = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.uTabControl1.SuspendLayout(); this.uTabControl1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
@ -125,7 +125,7 @@
this.uTabControl1.Location = new System.Drawing.Point(0, 0); this.uTabControl1.Location = new System.Drawing.Point(0, 0);
this.uTabControl1.Name = "uTabControl1"; this.uTabControl1.Name = "uTabControl1";
this.uTabControl1.SelectedIndex = 0; this.uTabControl1.SelectedIndex = 0;
this.uTabControl1.Size = new System.Drawing.Size(1276, 741);
this.uTabControl1.Size = new System.Drawing.Size(1276, 873);
this.uTabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; this.uTabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
this.uTabControl1.TabIndex = 0; this.uTabControl1.TabIndex = 0;
// //
@ -147,7 +147,7 @@
this.tabPage1.Location = new System.Drawing.Point(4, 54); this.tabPage1.Location = new System.Drawing.Point(4, 54);
this.tabPage1.Name = "tabPage1"; this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3); this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(1268, 683);
this.tabPage1.Size = new System.Drawing.Size(1268, 815);
this.tabPage1.TabIndex = 0; this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "验质分圈"; this.tabPage1.Text = "验质分圈";
this.tabPage1.UseVisualStyleBackColor = true; this.tabPage1.UseVisualStyleBackColor = true;
@ -447,11 +447,11 @@
this.weightBillGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.weightBillGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.weightBillGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.weightBillGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.W_ID, this.W_ID,
this.W_AlreadyHouse,
this.W_B3ID, this.W_B3ID,
this.W_Supplier_Name, this.W_Supplier_Name,
this.W_HouseNumber, this.W_HouseNumber,
this.W_HouseNames,
this.W_FinishCreate});
this.W_HouseNames});
this.weightBillGrid.Location = new System.Drawing.Point(25, 77); this.weightBillGrid.Location = new System.Drawing.Point(25, 77);
this.weightBillGrid.MultiSelect = false; this.weightBillGrid.MultiSelect = false;
this.weightBillGrid.Name = "weightBillGrid"; this.weightBillGrid.Name = "weightBillGrid";
@ -464,6 +464,52 @@
this.weightBillGrid.Size = new System.Drawing.Size(452, 401); this.weightBillGrid.Size = new System.Drawing.Size(452, 401);
this.weightBillGrid.TabIndex = 34; this.weightBillGrid.TabIndex = 34;
// //
// W_ID
//
this.W_ID.DataPropertyName = "ID";
this.W_ID.HeaderText = "ID";
this.W_ID.Name = "W_ID";
this.W_ID.ReadOnly = true;
this.W_ID.Visible = false;
//
// W_AlreadyHouse
//
this.W_AlreadyHouse.DataPropertyName = "AlreadyHouse";
this.W_AlreadyHouse.HeaderText = "AlreadyHouse";
this.W_AlreadyHouse.Name = "W_AlreadyHouse";
this.W_AlreadyHouse.ReadOnly = true;
this.W_AlreadyHouse.Visible = false;
//
// W_B3ID
//
this.W_B3ID.DataPropertyName = "B3ID";
this.W_B3ID.HeaderText = "过磅单号";
this.W_B3ID.Name = "W_B3ID";
this.W_B3ID.ReadOnly = true;
//
// W_Supplier_Name
//
this.W_Supplier_Name.DataPropertyName = "Supplier_Name";
this.W_Supplier_Name.HeaderText = "供应商";
this.W_Supplier_Name.Name = "W_Supplier_Name";
this.W_Supplier_Name.ReadOnly = true;
this.W_Supplier_Name.Width = 120;
//
// W_HouseNumber
//
this.W_HouseNumber.DataPropertyName = "HouseNumber";
this.W_HouseNumber.HeaderText = "头数";
this.W_HouseNumber.Name = "W_HouseNumber";
this.W_HouseNumber.ReadOnly = true;
//
// W_HouseNames
//
this.W_HouseNames.DataPropertyName = "HouseNames";
this.W_HouseNames.HeaderText = "圈舍";
this.W_HouseNames.Name = "W_HouseNames";
this.W_HouseNames.ReadOnly = true;
this.W_HouseNames.Width = 120;
//
// syncBtn // syncBtn
// //
this.syncBtn.Font = new System.Drawing.Font("宋体", 15F); this.syncBtn.Font = new System.Drawing.Font("宋体", 15F);
@ -768,57 +814,11 @@
this.label4.TabIndex = 35; this.label4.TabIndex = 35;
this.label4.Text = "日期:"; this.label4.Text = "日期:";
// //
// W_ID
//
this.W_ID.DataPropertyName = "ID";
this.W_ID.HeaderText = "ID";
this.W_ID.Name = "W_ID";
this.W_ID.ReadOnly = true;
this.W_ID.Visible = false;
//
// W_B3ID
//
this.W_B3ID.DataPropertyName = "B3ID";
this.W_B3ID.HeaderText = "过磅单号";
this.W_B3ID.Name = "W_B3ID";
this.W_B3ID.ReadOnly = true;
//
// W_Supplier_Name
//
this.W_Supplier_Name.DataPropertyName = "Supplier_Name";
this.W_Supplier_Name.HeaderText = "供应商";
this.W_Supplier_Name.Name = "W_Supplier_Name";
this.W_Supplier_Name.ReadOnly = true;
this.W_Supplier_Name.Width = 120;
//
// W_HouseNumber
//
this.W_HouseNumber.DataPropertyName = "HouseNumber";
this.W_HouseNumber.HeaderText = "头数";
this.W_HouseNumber.Name = "W_HouseNumber";
this.W_HouseNumber.ReadOnly = true;
//
// W_HouseNames
//
this.W_HouseNames.DataPropertyName = "HouseNames";
this.W_HouseNames.HeaderText = "圈舍";
this.W_HouseNames.Name = "W_HouseNames";
this.W_HouseNames.ReadOnly = true;
this.W_HouseNames.Width = 120;
//
// W_FinishCreate
//
this.W_FinishCreate.DataPropertyName = "FinishCreate";
this.W_FinishCreate.HeaderText = "标识列勿去";
this.W_FinishCreate.Name = "W_FinishCreate";
this.W_FinishCreate.ReadOnly = true;
this.W_FinishCreate.Visible = false;
//
// QualityOrderForm // QualityOrderForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1276, 741);
this.ClientSize = new System.Drawing.Size(1276, 873);
this.Controls.Add(this.uTabControl1); this.Controls.Add(this.uTabControl1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false; this.MaximizeBox = false;
@ -901,11 +901,11 @@
private System.Windows.Forms.DataGridViewTextBoxColumn S_Sanction_ID3; private System.Windows.Forms.DataGridViewTextBoxColumn S_Sanction_ID3;
private System.Windows.Forms.DataGridViewTextBoxColumn S_AbnormalItem_ID3; private System.Windows.Forms.DataGridViewTextBoxColumn S_AbnormalItem_ID3;
private System.Windows.Forms.DataGridViewTextBoxColumn W_ID; private System.Windows.Forms.DataGridViewTextBoxColumn W_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn W_AlreadyHouse;
private System.Windows.Forms.DataGridViewTextBoxColumn W_B3ID; private System.Windows.Forms.DataGridViewTextBoxColumn W_B3ID;
private System.Windows.Forms.DataGridViewTextBoxColumn W_Supplier_Name; private System.Windows.Forms.DataGridViewTextBoxColumn W_Supplier_Name;
private System.Windows.Forms.DataGridViewTextBoxColumn W_HouseNumber; private System.Windows.Forms.DataGridViewTextBoxColumn W_HouseNumber;
private System.Windows.Forms.DataGridViewTextBoxColumn W_HouseNames; private System.Windows.Forms.DataGridViewTextBoxColumn W_HouseNames;
private System.Windows.Forms.DataGridViewTextBoxColumn W_FinishCreate;


+ 43
- 19
QualityAndOrder/QualityOrderForm.cs View File

@ -1,7 +1,6 @@
using BO.BO; using BO.BO;
using BO.Utils; using BO.Utils;
using BO.Utils.BillRpc; using BO.Utils.BillRpc;
using ButcherManageClient;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@ -9,6 +8,7 @@ using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
@ -19,7 +19,7 @@ namespace QualityAndOrder
#region IAfterLogin #region IAfterLogin
public string RoleName public string RoleName
{ {
get { return "_1"; }
get { return "验质员"; }
} }
public Form Generate() public Form Generate()
@ -33,15 +33,23 @@ namespace QualityAndOrder
List<HouseSplitEntity> houseList; List<HouseSplitEntity> houseList;
List<SanctionSplit3Part> sanctionList; List<SanctionSplit3Part> sanctionList;
List<WeightBill> weightBills; List<WeightBill> weightBills;
private Thread tab1SyncThread;
bool mainIsRun = false;
readonly Color btnSelectForeColor = Color.FromArgb(255, 255, 255); readonly Color btnSelectForeColor = Color.FromArgb(255, 255, 255);
readonly Color btnSelectBackColor = Color.FromArgb(66, 163, 218); readonly Color btnSelectBackColor = Color.FromArgb(66, 163, 218);
Color btnUnSelectForeColor = SystemColors.ControlText; Color btnUnSelectForeColor = SystemColors.ControlText;
Color btnUnSelectBackColor = Color.FromArgb(225, 225, 225); Color btnUnSelectBackColor = Color.FromArgb(225, 225, 225);
int inHouseNumber = 0;
public QualityOrderForm() public QualityOrderForm()
{ {
InitializeComponent(); InitializeComponent();
this.FormClosing += delegate
{
if (tab1SyncThread != null && tab1SyncThread.IsAlive)
{
tab1SyncThread.Abort();
}
};
testTimeInput.Date = tab2DateSelect.Date = DateTime.Today; testTimeInput.Date = tab2DateSelect.Date = DateTime.Today;
syncBtn.Focus(); syncBtn.Focus();
this.uTabControl1.Selected += (sender, e) => this.uTabControl1.Selected += (sender, e) =>
@ -63,18 +71,19 @@ namespace QualityAndOrder
numberBox.LostFocus += (sender, e) => { flag = 1; }; numberBox.LostFocus += (sender, e) => { flag = 1; };
sanctionGrid.GotFocus += (sender, e) => { flag = 2; }; sanctionGrid.GotFocus += (sender, e) => { flag = 2; };
mainIsRun = true;
} }
int flag = 0; int flag = 0;
private void BindWeightBillGrid() private void BindWeightBillGrid()
{ {
weightBillGrid.DataSource = weightBills.OrderBy(x => x.ID).OrderBy(x => x.FinishCreate).ToList();
weightBillGrid.DataSource = null;
weightBillGrid.DataSource = weightBills.OrderBy(x => x.ID).OrderBy(x => x.AlreadyHouse).ToList();
foreach (DataGridViewRow row in weightBillGrid.Rows) foreach (DataGridViewRow row in weightBillGrid.Rows)
{ {
if ((bool)row.Cells["W_FinishCreate"].Value)
if ((bool)row.Cells["W_AlreadyHouse"].Value)
row.DefaultCellStyle.BackColor = Color.YellowGreen; row.DefaultCellStyle.BackColor = Color.YellowGreen;
} }
weightBillGrid.Refresh(); weightBillGrid.Refresh();
} }
@ -309,15 +318,14 @@ namespace QualityAndOrder
private void commitBtn_Click(object sender, EventArgs e) private void commitBtn_Click(object sender, EventArgs e)
{ {
var entity = GetHouseDataFromUI(); var entity = GetHouseDataFromUI();
entity.AlreadyHouse = true;
var result = WeightBillRpc.InsertHouseAndSanctionInfo(entity); var result = WeightBillRpc.InsertHouseAndSanctionInfo(entity);
if (result == 1) if (result == 1)
{ {
MessageBox.Show("提交成功"); MessageBox.Show("提交成功");
entity.FinishCreate = true;
BindWeightBillGrid();
inHouseNumber += (entity.HouseNumber ?? 0);
inHouseNumberLabel.Text = inHouseNumber.ToString();
ResetTab1Controls();
BindWeightBillGrid();
BindNumberLabel();
ResetTab1Controls();
} }
else else
MessageBox.Show("结果", "提交失败", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("结果", "提交失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
@ -325,10 +333,24 @@ namespace QualityAndOrder
private void syncBtn_Click(object sender, EventArgs e) private void syncBtn_Click(object sender, EventArgs e)
{ {
weightBills = WeightBillRpc.GetUnHousedBill(testTimeInput.Date.Value);
BindWeightBillGrid();
tab1SyncThread = new Thread(StartQuery) { IsBackground = true };
tab1SyncThread.Start();
}
private void StartQuery()
{
while (mainIsRun)
{
weightBills = WeightBillRpc.GetUnHousedBill(testTimeInput.Date.Value);
BindWeightBillGrid();
BindNumberLabel();
Thread.Sleep(5000);
}
}
inHouseNumber = WeightBillRpc.GetHouseDetailTotalNumber(testTimeInput.Date.Value);
void BindNumberLabel()
{
var inHouseNumber = WeightBillRpc.GetHouseDetailTotalNumber(testTimeInput.Date.Value);
inHouseNumberLabel.Text = inHouseNumber.ToString(); inHouseNumberLabel.Text = inHouseNumber.ToString();
} }
@ -345,11 +367,13 @@ namespace QualityAndOrder
throw new Exception("请选等级"); throw new Exception("请选等级");
if (houseSelectedBtn.Count == 0) if (houseSelectedBtn.Count == 0)
throw new Exception("请选择圈舍"); throw new Exception("请选择圈舍");
if (houseSelectedBtn.Count > 1)
throw new Exception("不允许分圈");
var house = houseSelectedBtn[0].Tag as Tuple<string, string>;
entity.HouseDetails.Add(new WeightBill_HouseDetail() { WeightBill_ID = entity.ID, Index = 1, LiveColonyHouse_ID = long.Parse(house.Item1), LiveColonyHouse_Name = house.Item2, Number = int.Parse(numberBox.Text) });
foreach (var btn in houseSelectedBtn)
{
var house = btn.Tag as Tuple<string, string>;
var houseDetail = new WeightBill_HouseDetail() { WeightBill_ID = entity.ID, LiveColonyHouse_ID = long.Parse(house.Item1), LiveColonyHouse_Name = house.Item2, Number = int.Parse(numberBox.Text) };
entity.HouseDetails.Add(houseDetail);
houseDetail.Index = entity.HouseDetails.Max(x => x.Index) + 1;
}
var gradeTag = currentBtn.Tag as Tuple<string, string>; var gradeTag = currentBtn.Tag as Tuple<string, string>;
entity.HogGrade_ID = long.Parse(gradeTag.Item1); entity.HogGrade_ID = long.Parse(gradeTag.Item1);
entity.HogGrade_Name = gradeTag.Item2; entity.HogGrade_Name = gradeTag.Item2;


+ 3
- 3
QualityAndOrder/QualityOrderForm.resx View File

@ -156,6 +156,9 @@
<metadata name="W_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="W_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </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"> <metadata name="W_B3ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
@ -168,9 +171,6 @@
<metadata name="W_HouseNames.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="W_HouseNames.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="W_FinishCreate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="P_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="P_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>


BIN
Setup/Release/Setup.msi View File


BIN
Setup/Release/setup.exe View File


+ 1293
- 0
Setup/Setup.vdproj
File diff suppressed because it is too large
View File


Loading…
Cancel
Save