Browse Source

some change

master
yibo 7 years ago
parent
commit
3cce5a38f2
10 changed files with 489 additions and 163 deletions
  1. +4
    -1
      ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs
  2. +1
    -0
      ButcherFactory.BO/BaseInfo/Goods.cs
  3. +1
    -1
      ButcherFactory.BO/ButcherFactory.BO.csproj
  4. +64
    -22
      ButcherFactory.BO/LocalBL/CarcassInStoreBL.cs
  5. +2
    -0
      ButcherFactory.BO/Rpcs/BaseInfoSyncRpc.cs
  6. +23
    -0
      ButcherFactory.BO/Utils/Extensions.cs
  7. +230
    -93
      ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.Designer.cs
  8. +151
    -12
      ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs
  9. +10
    -34
      ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.resx
  10. +3
    -0
      ButcherFactory.Login/Login.Designer.cs

+ 4
- 1
ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs View File

@ -14,6 +14,10 @@ namespace ButcherFactory.BO
[NonDmoProperty] [NonDmoProperty]
public List<ClientGoodsSet_Detail> Details { get { return mDetails; } } public List<ClientGoodsSet_Detail> Details { get { return mDetails; } }
private List<Goods> mGoods = new List<Goods>();
[NonDmoProperty]
public List<Goods> Goods { get { return mGoods; } }
[NonDmoProperty] [NonDmoProperty]
public bool Stopped { get; set; } public bool Stopped { get; set; }
} }
@ -27,7 +31,6 @@ namespace ButcherFactory.BO
public long Goods_ID { get; set; } public long Goods_ID { get; set; }
[NonDmoProperty]
[ReferenceTo(typeof(Goods), "Name")] [ReferenceTo(typeof(Goods), "Name")]
[Join("Goods_ID", "ID")] [Join("Goods_ID", "ID")]
public string Goods_Name { get; set; } public string Goods_Name { get; set; }


+ 1
- 0
ButcherFactory.BO/BaseInfo/Goods.cs View File

@ -8,6 +8,7 @@ using System.Threading.Tasks;
namespace ButcherFactory.BO namespace ButcherFactory.BO
{ {
[MapToTable("Butcher_Goods")] [MapToTable("Butcher_Goods")]
[KeyField("ID", KeyGenType.assigned)]
public class Goods : BaseInfo public class Goods : BaseInfo
{ {
public string MainUnit { get; set; } public string MainUnit { get; set; }


+ 1
- 1
ButcherFactory.BO/ButcherFactory.BO.csproj View File

@ -57,13 +57,13 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="BaseInfo\ClientGoodsSet.cs" /> <Compile Include="BaseInfo\ClientGoodsSet.cs" />
<Compile Include="BaseInfo\Goods.cs" />
<Compile Include="Base\BaseInfo.cs" /> <Compile Include="Base\BaseInfo.cs" />
<Compile Include="BaseInfo\ProductBatch.cs" /> <Compile Include="BaseInfo\ProductBatch.cs" />
<Compile Include="Base\SimpleBackObjs.cs" /> <Compile Include="Base\SimpleBackObjs.cs" />
<Compile Include="Enums\ApplyClient.cs" /> <Compile Include="Enums\ApplyClient.cs" />
<Compile Include="Enums\DriveType.cs" /> <Compile Include="Enums\DriveType.cs" />
<Compile Include="Base\SyncBill.cs" /> <Compile Include="Base\SyncBill.cs" />
<Compile Include="BaseInfo\Goods.cs" />
<Compile Include="BaseInfo\WorkUnit.cs" /> <Compile Include="BaseInfo\WorkUnit.cs" />
<Compile Include="BaseInfo\Worker.cs" /> <Compile Include="BaseInfo\Worker.cs" />
<Compile Include="Base\WorkerGoodsSetProfile.cs" /> <Compile Include="Base\WorkerGoodsSetProfile.cs" />


+ 64
- 22
ButcherFactory.BO/LocalBL/CarcassInStoreBL.cs View File

@ -17,47 +17,79 @@ namespace ButcherFactory.BO.LocalBL
public static class CarcassInStoreBL public static class CarcassInStoreBL
{ {
const string RpcPath = @"/MainSystem/B3ClientService/Rpcs/CarcassInStoreRpc/"; const string RpcPath = @"/MainSystem/B3ClientService/Rpcs/CarcassInStoreRpc/";
public static bool DoWithPadData(long? workUnitID, long? productBatch)
static Dictionary<long, string> _goodsNames = new Dictionary<long, string>();
public static List<CarcassInStore> DoWithPadData(long? workUnitID, long? productBatch)
{ {
bool changed = false;
var json = RpcFacade.Call<string>(RpcPath + "GetUnSyncPadData"); var json = RpcFacade.Call<string>(RpcPath + "GetUnSyncPadData");
var data = JsonConvert.DeserializeObject<List<PadCarcassInStore>>(json).OrderBy(x => x.ID);
var data = JsonConvert.DeserializeObject<List<PadCarcassInStore>>(json);
var list = new List<CarcassInStore>();
if (data.Count == 0)
return list;
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection)) using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
{ {
foreach (var item in data) foreach (var item in data)
{ {
if (UpdateIfExist(item, session))
continue;
changed = true;
var entity = new CarcassInStore();
entity.FromPad = true;
entity.WorkUnit_ID = workUnitID;
entity.ProductBatch_ID = productBatch;
entity.UserID = AppContext.Worker.ID;
entity.BarCode = item.BarCode;
entity.Goods_ID = item.Goods_ID;
session.Insert(entity);
var id = UpdateIfExist(item, session);
if (id.HasValue)
{
var exist = new CarcassInStore();
list.Add(exist);
exist.ID = id.Value;
exist.Goods_ID = item.Goods_ID;
exist.Goods_Name = GetGoodsName(item.Goods_ID, session);
}
else
{
var entity = CreateCarcassInStore(item);
entity.WorkUnit_ID = workUnitID;
entity.ProductBatch_ID = productBatch;
entity.Goods_Name = GetGoodsName(item.Goods_ID, session);
session.Insert(entity);
list.Add(entity);
}
} }
session.Commit(); session.Commit();
} }
var backInfo = data.Select(x => new IDRowVersion { ID = x.ID, RowVersion = x.RowVersion }); var backInfo = data.Select(x => new IDRowVersion { ID = x.ID, RowVersion = x.RowVersion });
RpcFacade.Call<int>(RpcPath + "SetPadDataSync", JsonConvert.SerializeObject(backInfo)); RpcFacade.Call<int>(RpcPath + "SetPadDataSync", JsonConvert.SerializeObject(backInfo));
return changed;
return list;
}
private static CarcassInStore CreateCarcassInStore(PadCarcassInStore item)
{
var entity = new CarcassInStore();
entity.FromPad = true;
entity.UserID = AppContext.Worker.ID;
entity.BarCode = item.BarCode;
entity.Goods_ID = item.Goods_ID;
return entity;
} }
static bool UpdateIfExist(PadCarcassInStore data, IDmoSession session)
static string GetGoodsName(long id, IDmoSession session)
{
if (!_goodsNames.ContainsKey(id))
{
var query = new DQueryDom(new JoinAlias(typeof(Goods)));
query.Columns.Add(DQSelectColumn.Field("Name"));
query.Where.Conditions.Add(DQCondition.EQ("ID", id));
_goodsNames.Add(id, query.EExecuteScalar<string>(session));
}
return _goodsNames[id];
}
static long? UpdateIfExist(PadCarcassInStore data, IDmoSession session)
{ {
var query = new DQueryDom(new JoinAlias(typeof(CarcassInStore))); var query = new DQueryDom(new JoinAlias(typeof(CarcassInStore)));
query.Columns.Add(DQSelectColumn.Field("ID")); query.Columns.Add(DQSelectColumn.Field("ID"));
query.Where.Conditions.Add(DQCondition.EQ("BarCode", data.BarCode)); query.Where.Conditions.Add(DQCondition.EQ("BarCode", data.BarCode));
var id = (long?)session.ExecuteScalar(query); var id = (long?)session.ExecuteScalar(query);
if (id == null) if (id == null)
return false;
return null;
Update(id.Value, "Goods_ID", data.Goods_ID, session); Update(id.Value, "Goods_ID", data.Goods_ID, session);
return true;
return id.Value;
} }
public static void Update(long id, string fileName, object value, IDmoSession session)
static void Update(long id, string fileName, object value, IDmoSession session)
{ {
var update = new DQUpdateDom(typeof(CarcassInStore)); var update = new DQUpdateDom(typeof(CarcassInStore));
update.Where.Conditions.Add(DQCondition.EQ("ID", id)); update.Where.Conditions.Add(DQCondition.EQ("ID", id));
@ -67,6 +99,15 @@ namespace ButcherFactory.BO.LocalBL
session.ExecuteNonQuery(update); session.ExecuteNonQuery(update);
} }
public static void Update(long id, string fileName, object value)
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
{
Update(id, fileName, value, session);
session.Commit();
}
}
public static long Insert(CarcassInStore entity) public static long Insert(CarcassInStore entity)
{ {
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection)) using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
@ -77,13 +118,13 @@ namespace ButcherFactory.BO.LocalBL
} }
} }
public static BindingList<CarcassInStore> GetLocalDataWithState(bool submit)
public static BindingList<CarcassInStore> GetLocalDataWithState(bool history)
{ {
var query = new DQueryDom(new JoinAlias(typeof(CarcassInStore))); var query = new DQueryDom(new JoinAlias(typeof(CarcassInStore)));
query.Columns.Add(DQSelectColumn.Field("ID")); query.Columns.Add(DQSelectColumn.Field("ID"));
query.Columns.Add(DQSelectColumn.Field("BarCode")); query.Columns.Add(DQSelectColumn.Field("BarCode"));
query.Columns.Add(DQSelectColumn.Field("Goods_Name")); query.Columns.Add(DQSelectColumn.Field("Goods_Name"));
if (submit)
if (history)
{ {
query.Columns.Add(DQSelectColumn.Field("Weight")); query.Columns.Add(DQSelectColumn.Field("Weight"));
query.Columns.Add(DQSelectColumn.Field("BeforeWeight")); query.Columns.Add(DQSelectColumn.Field("BeforeWeight"));
@ -92,6 +133,7 @@ namespace ButcherFactory.BO.LocalBL
} }
else else
query.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field("Weight"))); query.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field("Weight")));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true));
var result = new BindingList<CarcassInStore>(); var result = new BindingList<CarcassInStore>();
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection)) using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
{ {
@ -104,7 +146,7 @@ namespace ButcherFactory.BO.LocalBL
entity.ID = (long)reader[0]; entity.ID = (long)reader[0];
entity.BarCode = (string)reader[1]; entity.BarCode = (string)reader[1];
entity.Goods_Name = (string)reader[2]; entity.Goods_Name = (string)reader[2];
if (submit)
if (history)
{ {
entity.Weight = (decimal)reader[3]; entity.Weight = (decimal)reader[3];
entity.BeforeWeight = (decimal?)reader[4]; entity.BeforeWeight = (decimal?)reader[4];


+ 2
- 0
ButcherFactory.BO/Rpcs/BaseInfoSyncRpc.cs View File

@ -71,6 +71,8 @@ namespace ButcherFactory.BO.Rpcs
session.Insert(entity); session.Insert(entity);
foreach (var detail in entity.Details) foreach (var detail in entity.Details)
session.Insert(detail); session.Insert(detail);
foreach (var goods in entity.Goods)
session.AddUpdateOrInsert(goods);
} }
} }
} }

+ 23
- 0
ButcherFactory.BO/Utils/Extensions.cs View File

@ -13,6 +13,29 @@ namespace ButcherFactory.BO
{ {
public static class Extensions public static class Extensions
{ {
public static object EExecuteScalar(this DQueryDom query, IDmoSession session)
{
return session.ExecuteScalar(query);
}
public static object EExecuteScalar(this DQueryDom query)
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
{
return query.EExecuteScalar(session);
}
}
public static T EExecuteScalar<T>(this DQueryDom query, IDmoSession session)
{
return (T)query.EExecuteScalar(session);
}
public static T EExecuteScalar<T>(this DQueryDom query)
{
return (T)query.EExecuteScalar();
}
public static Tuple<T1, T2> EExecuteScalar<T1, T2>(this DQueryDom query, IDmoSession session) public static Tuple<T1, T2> EExecuteScalar<T1, T2>(this DQueryDom query, IDmoSession session)
{ {
var list = query.EExecuteList<T1, T2>(session); var list = query.EExecuteList<T1, T2>(session);


+ 230
- 93
ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.Designer.cs View File

@ -31,37 +31,53 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CarcassInStoreForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CarcassInStoreForm));
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = 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 dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = 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 dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = 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();
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.closeBtn = new WinFormControl.UButton();
this.uTimerLabel1 = new WinFormControl.UTimerLabel();
this.productBatchSelect = new System.Windows.Forms.ComboBox(); this.productBatchSelect = new System.Windows.Forms.ComboBox();
this.workUnitSelect = new System.Windows.Forms.ComboBox(); this.workUnitSelect = new System.Windows.Forms.ComboBox();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.closeBtn = new WinFormControl.UButton();
this.uTimerLabel1 = new WinFormControl.UTimerLabel();
this.uScanPanel1 = new WinFormControl.UScanPanel(); this.uScanPanel1 = new WinFormControl.UScanPanel();
this.netStateWatch1 = new WinFormControl.NetStateWatch(); this.netStateWatch1 = new WinFormControl.NetStateWatch();
this.uWeightControl1 = new WinFormControl.UWeightControl(); this.uWeightControl1 = new WinFormControl.UWeightControl();
this.uLabel1 = new WinFormControl.ULabel(); this.uLabel1 = new WinFormControl.ULabel();
this.uLabel2 = new WinFormControl.ULabel(); this.uLabel2 = new WinFormControl.ULabel();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.historyDataGrid = new WinFormControl.UDataGridView(); this.historyDataGrid = new WinFormControl.UDataGridView();
this.uLabel4 = new WinFormControl.ULabel(); this.uLabel4 = new WinFormControl.ULabel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.needSubmitGrid = new WinFormControl.UDataGridView(); this.needSubmitGrid = new WinFormControl.UDataGridView();
this.uLabel3 = new WinFormControl.ULabel(); this.uLabel3 = new WinFormControl.ULabel();
this.U_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.U_BarCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.U_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.U_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_BarCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_BeforeWeight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Discont = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout(); this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout(); this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout(); this.splitContainer2.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.historyDataGrid)).BeginInit();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.historyDataGrid)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.needSubmitGrid)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.needSubmitGrid)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -96,6 +112,84 @@
this.splitContainer1.SplitterDistance = 86; this.splitContainer1.SplitterDistance = 86;
this.splitContainer1.TabIndex = 0; this.splitContainer1.TabIndex = 0;
// //
// productBatchSelect
//
this.productBatchSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.productBatchSelect.Font = new System.Drawing.Font("宋体", 15F);
this.productBatchSelect.FormattingEnabled = true;
this.productBatchSelect.Location = new System.Drawing.Point(843, 47);
this.productBatchSelect.Name = "productBatchSelect";
this.productBatchSelect.Size = new System.Drawing.Size(170, 28);
this.productBatchSelect.TabIndex = 4;
//
// workUnitSelect
//
this.workUnitSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.workUnitSelect.Font = new System.Drawing.Font("宋体", 15F);
this.workUnitSelect.FormattingEnabled = true;
this.workUnitSelect.Location = new System.Drawing.Point(843, 11);
this.workUnitSelect.Name = "workUnitSelect";
this.workUnitSelect.Size = new System.Drawing.Size(170, 28);
this.workUnitSelect.TabIndex = 3;
//
// splitContainer2
//
this.splitContainer2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer2.IsSplitterFixed = true;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.BackColor = System.Drawing.Color.Transparent;
this.splitContainer2.Panel1.Controls.Add(this.groupBox2);
this.splitContainer2.Panel1.Controls.Add(this.groupBox1);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.BackColor = System.Drawing.Color.Transparent;
this.splitContainer2.Panel2.Controls.Add(this.flowLayoutPanel1);
this.splitContainer2.Size = new System.Drawing.Size(1164, 521);
this.splitContainer2.SplitterDistance = 840;
this.splitContainer2.TabIndex = 0;
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.Controls.Add(this.historyDataGrid);
this.groupBox2.Controls.Add(this.uLabel4);
this.groupBox2.Location = new System.Drawing.Point(11, 254);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(5);
this.groupBox2.Size = new System.Drawing.Size(815, 254);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.needSubmitGrid);
this.groupBox1.Controls.Add(this.uLabel3);
this.groupBox1.Location = new System.Drawing.Point(11, 15);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(5);
this.groupBox1.Size = new System.Drawing.Size(815, 226);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(318, 519);
this.flowLayoutPanel1.TabIndex = 0;
//
// closeBtn // closeBtn
// //
this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@ -113,6 +207,7 @@
this.closeBtn.TabIndex = 9; this.closeBtn.TabIndex = 9;
this.closeBtn.Text = "关 闭"; this.closeBtn.Text = "关 闭";
this.closeBtn.UseVisualStyleBackColor = true; this.closeBtn.UseVisualStyleBackColor = true;
this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click);
// //
// uTimerLabel1 // uTimerLabel1
// //
@ -120,33 +215,13 @@
this.uTimerLabel1.AutoSize = true; this.uTimerLabel1.AutoSize = true;
this.uTimerLabel1.BackColor = System.Drawing.Color.Transparent; this.uTimerLabel1.BackColor = System.Drawing.Color.Transparent;
this.uTimerLabel1.Font = new System.Drawing.Font("黑体", 12F); this.uTimerLabel1.Font = new System.Drawing.Font("黑体", 12F);
this.uTimerLabel1.Format = "M月d日 H:m:ss";
this.uTimerLabel1.Format = "M月d日 H:mm:ss";
this.uTimerLabel1.Location = new System.Drawing.Point(1024, 53); this.uTimerLabel1.Location = new System.Drawing.Point(1024, 53);
this.uTimerLabel1.Name = "uTimerLabel1"; this.uTimerLabel1.Name = "uTimerLabel1";
this.uTimerLabel1.Size = new System.Drawing.Size(128, 16); this.uTimerLabel1.Size = new System.Drawing.Size(128, 16);
this.uTimerLabel1.TabIndex = 8; this.uTimerLabel1.TabIndex = 8;
this.uTimerLabel1.Text = "3月30日 8:54:07"; this.uTimerLabel1.Text = "3月30日 8:54:07";
// //
// productBatchSelect
//
this.productBatchSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.productBatchSelect.Font = new System.Drawing.Font("宋体", 15F);
this.productBatchSelect.FormattingEnabled = true;
this.productBatchSelect.Location = new System.Drawing.Point(843, 47);
this.productBatchSelect.Name = "productBatchSelect";
this.productBatchSelect.Size = new System.Drawing.Size(170, 28);
this.productBatchSelect.TabIndex = 4;
//
// workUnitSelect
//
this.workUnitSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.workUnitSelect.Font = new System.Drawing.Font("宋体", 15F);
this.workUnitSelect.FormattingEnabled = true;
this.workUnitSelect.Location = new System.Drawing.Point(843, 11);
this.workUnitSelect.Name = "workUnitSelect";
this.workUnitSelect.Size = new System.Drawing.Size(170, 28);
this.workUnitSelect.TabIndex = 3;
//
// uScanPanel1 // uScanPanel1
// //
this.uScanPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.uScanPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@ -197,42 +272,6 @@
this.uLabel2.TabIndex = 6; this.uLabel2.TabIndex = 6;
this.uLabel2.Text = "生产批次:"; this.uLabel2.Text = "生产批次:";
// //
// splitContainer2
//
this.splitContainer2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer2.IsSplitterFixed = true;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.BackColor = System.Drawing.Color.Transparent;
this.splitContainer2.Panel1.Controls.Add(this.groupBox2);
this.splitContainer2.Panel1.Controls.Add(this.groupBox1);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.BackColor = System.Drawing.Color.Transparent;
this.splitContainer2.Size = new System.Drawing.Size(1164, 521);
this.splitContainer2.SplitterDistance = 836;
this.splitContainer2.TabIndex = 0;
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.Controls.Add(this.historyDataGrid);
this.groupBox2.Controls.Add(this.uLabel4);
this.groupBox2.Location = new System.Drawing.Point(11, 254);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(5);
this.groupBox2.Size = new System.Drawing.Size(811, 254);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
//
// historyDataGrid // historyDataGrid
// //
this.historyDataGrid.AllowUserToAddRows = false; this.historyDataGrid.AllowUserToAddRows = false;
@ -248,17 +287,25 @@
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.historyDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; this.historyDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.historyDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.historyDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.historyDataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.H_ID,
this.H_BarCode,
this.H_Goods_Name,
this.H_Weight,
this.H_BeforeWeight,
this.H_Discont});
this.historyDataGrid.Dock = System.Windows.Forms.DockStyle.Fill; this.historyDataGrid.Dock = System.Windows.Forms.DockStyle.Fill;
this.historyDataGrid.Location = new System.Drawing.Point(5, 19); this.historyDataGrid.Location = new System.Drawing.Point(5, 19);
this.historyDataGrid.MultiSelect = false; this.historyDataGrid.MultiSelect = false;
this.historyDataGrid.Name = "historyDataGrid"; this.historyDataGrid.Name = "historyDataGrid";
this.historyDataGrid.ReadOnly = true;
this.historyDataGrid.RowHeadersVisible = false; this.historyDataGrid.RowHeadersVisible = false;
dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.historyDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle3;
dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.historyDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle6;
this.historyDataGrid.RowTemplate.Height = 23; this.historyDataGrid.RowTemplate.Height = 23;
this.historyDataGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.historyDataGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.historyDataGrid.Size = new System.Drawing.Size(801, 230);
this.historyDataGrid.Size = new System.Drawing.Size(805, 230);
this.historyDataGrid.TabIndex = 2; this.historyDataGrid.TabIndex = 2;
// //
// uLabel4 // uLabel4
@ -272,45 +319,38 @@
this.uLabel4.TabIndex = 1; this.uLabel4.TabIndex = 1;
this.uLabel4.Text = "已提交"; this.uLabel4.Text = "已提交";
// //
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.needSubmitGrid);
this.groupBox1.Controls.Add(this.uLabel3);
this.groupBox1.Location = new System.Drawing.Point(11, 15);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(5);
this.groupBox1.Size = new System.Drawing.Size(811, 226);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
//
// needSubmitGrid // needSubmitGrid
// //
this.needSubmitGrid.AllowUserToAddRows = false; this.needSubmitGrid.AllowUserToAddRows = false;
this.needSubmitGrid.AllowUserToDeleteRows = false; this.needSubmitGrid.AllowUserToDeleteRows = false;
this.needSubmitGrid.AllowUserToResizeColumns = false; this.needSubmitGrid.AllowUserToResizeColumns = false;
this.needSubmitGrid.AllowUserToResizeRows = false; this.needSubmitGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.needSubmitGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4;
dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.needSubmitGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7;
this.needSubmitGrid.BackgroundColor = System.Drawing.Color.White; this.needSubmitGrid.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle5.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.needSubmitGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle8.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.needSubmitGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8;
this.needSubmitGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.needSubmitGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.needSubmitGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.U_ID,
this.U_BarCode,
this.U_Goods_Name,
this.U_Weight});
this.needSubmitGrid.Dock = System.Windows.Forms.DockStyle.Fill; this.needSubmitGrid.Dock = System.Windows.Forms.DockStyle.Fill;
this.needSubmitGrid.Location = new System.Drawing.Point(5, 19); this.needSubmitGrid.Location = new System.Drawing.Point(5, 19);
this.needSubmitGrid.MultiSelect = false; this.needSubmitGrid.MultiSelect = false;
this.needSubmitGrid.Name = "needSubmitGrid"; this.needSubmitGrid.Name = "needSubmitGrid";
this.needSubmitGrid.ReadOnly = true;
this.needSubmitGrid.RowHeadersVisible = false; this.needSubmitGrid.RowHeadersVisible = false;
dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.needSubmitGrid.RowsDefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle10.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle10.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.needSubmitGrid.RowsDefaultCellStyle = dataGridViewCellStyle10;
this.needSubmitGrid.RowTemplate.Height = 23; this.needSubmitGrid.RowTemplate.Height = 23;
this.needSubmitGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.needSubmitGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.needSubmitGrid.Size = new System.Drawing.Size(801, 202);
this.needSubmitGrid.Size = new System.Drawing.Size(805, 202);
this.needSubmitGrid.TabIndex = 1; this.needSubmitGrid.TabIndex = 1;
// //
// uLabel3 // uLabel3
@ -324,6 +364,91 @@
this.uLabel3.TabIndex = 0; this.uLabel3.TabIndex = 0;
this.uLabel3.Text = "待提交"; this.uLabel3.Text = "待提交";
// //
// U_ID
//
this.U_ID.DataPropertyName = "ID";
this.U_ID.HeaderText = "ID";
this.U_ID.Name = "U_ID";
this.U_ID.ReadOnly = true;
this.U_ID.Visible = false;
//
// U_BarCode
//
this.U_BarCode.DataPropertyName = "BarCode";
this.U_BarCode.HeaderText = "条码";
this.U_BarCode.Name = "U_BarCode";
this.U_BarCode.ReadOnly = true;
this.U_BarCode.Width = 400;
//
// U_Goods_Name
//
this.U_Goods_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.U_Goods_Name.DataPropertyName = "Goods_Name";
this.U_Goods_Name.HeaderText = "产品名称";
this.U_Goods_Name.Name = "U_Goods_Name";
this.U_Goods_Name.ReadOnly = true;
//
// U_Weight
//
this.U_Weight.DataPropertyName = "Weight";
dataGridViewCellStyle9.Format = "#0.######";
this.U_Weight.DefaultCellStyle = dataGridViewCellStyle9;
this.U_Weight.HeaderText = "重量";
this.U_Weight.Name = "U_Weight";
this.U_Weight.ReadOnly = true;
this.U_Weight.Width = 200;
//
// H_ID
//
this.H_ID.DataPropertyName = "ID";
this.H_ID.HeaderText = "序号";
this.H_ID.Name = "H_ID";
this.H_ID.ReadOnly = true;
this.H_ID.Width = 80;
//
// H_BarCode
//
this.H_BarCode.DataPropertyName = "BarCode";
this.H_BarCode.HeaderText = "条码";
this.H_BarCode.Name = "H_BarCode";
this.H_BarCode.ReadOnly = true;
this.H_BarCode.Width = 250;
//
// H_Goods_Name
//
this.H_Goods_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.H_Goods_Name.DataPropertyName = "Goods_Name";
this.H_Goods_Name.HeaderText = "产品名称";
this.H_Goods_Name.Name = "H_Goods_Name";
this.H_Goods_Name.ReadOnly = true;
//
// H_Weight
//
this.H_Weight.DataPropertyName = "Weight";
dataGridViewCellStyle3.Format = "#0.######";
this.H_Weight.DefaultCellStyle = dataGridViewCellStyle3;
this.H_Weight.HeaderText = "入库重量";
this.H_Weight.Name = "H_Weight";
this.H_Weight.ReadOnly = true;
//
// H_BeforeWeight
//
this.H_BeforeWeight.DataPropertyName = "BeforeWeight";
dataGridViewCellStyle4.Format = "#0.######";
this.H_BeforeWeight.DefaultCellStyle = dataGridViewCellStyle4;
this.H_BeforeWeight.HeaderText = "胴体重量";
this.H_BeforeWeight.Name = "H_BeforeWeight";
this.H_BeforeWeight.ReadOnly = true;
//
// H_Discont
//
this.H_Discont.DataPropertyName = "Discont";
dataGridViewCellStyle5.Format = "#0.######";
this.H_Discont.DefaultCellStyle = dataGridViewCellStyle5;
this.H_Discont.HeaderText = "损耗";
this.H_Discont.Name = "H_Discont";
this.H_Discont.ReadOnly = true;
//
// CarcassInStoreForm // CarcassInStoreForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@ -341,13 +466,14 @@
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false); this.splitContainer1.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false); this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false); this.splitContainer2.ResumeLayout(false);
this.groupBox2.ResumeLayout(false); this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout(); this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.historyDataGrid)).EndInit();
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.historyDataGrid)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.needSubmitGrid)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.needSubmitGrid)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
@ -372,6 +498,17 @@
private WinFormControl.ULabel uLabel4; private WinFormControl.ULabel uLabel4;
private WinFormControl.UDataGridView needSubmitGrid; private WinFormControl.UDataGridView needSubmitGrid;
private WinFormControl.UDataGridView historyDataGrid; private WinFormControl.UDataGridView historyDataGrid;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.DataGridViewTextBoxColumn U_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn U_BarCode;
private System.Windows.Forms.DataGridViewTextBoxColumn U_Goods_Name;
private System.Windows.Forms.DataGridViewTextBoxColumn U_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn H_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn H_BarCode;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Goods_Name;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn H_BeforeWeight;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Discont;
} }

+ 151
- 12
ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs View File

@ -11,44 +11,183 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using ButcherFactory.Utils; using ButcherFactory.Utils;
using ButcherFactory.BO.LocalBL;
using WinFormControl;
using System.Threading;
namespace ButcherFactory.CarcassInStore_ namespace ButcherFactory.CarcassInStore_
{ {
public partial class CarcassInStoreForm : Form, IWithRoleForm public partial class CarcassInStoreForm : Form, IWithRoleForm
{ {
#region IWithRoleForm
public List<short> RoleName
{
get { return new List<short> { (short). }; }
}
public Form Generate()
{
return this;
}
#endregion
Thread syncPadTask;
Thread syncBeforeWeight;
Thread uploadData;
BindingList<CarcassInStore> needSubmitedList;
BindingList<CarcassInStore> historyList;
public CarcassInStoreForm() public CarcassInStoreForm()
{ {
InitializeComponent(); InitializeComponent();
netStateWatch1.GetConnectState = () => LoginUtil.TestConnection(500); netStateWatch1.GetConnectState = () => LoginUtil.TestConnection(500);
this.FormClosing += delegate
{
if (syncPadTask != null && syncPadTask.IsAlive)
syncPadTask.Abort();
if (syncBeforeWeight != null && syncBeforeWeight.IsAlive)
syncBeforeWeight.Abort();
if (uploadData != null && uploadData.IsAlive)
uploadData.Abort();
};
} }
protected override void OnLoad(EventArgs e) protected override void OnLoad(EventArgs e)
{ {
base.OnLoad(e); base.OnLoad(e);
SyncBaseInfo();
var initTask = new Thread(LoadBind);
initTask.Start();
syncPadTask = new Thread(SyncPadData);
syncPadTask.Start();
uWeightControl1.ReceivedValue += (weight) =>
{
this.Invoke(new Action(() =>
{
var last = needSubmitedList.LastOrDefault();
if (last == null)
{
SoundPalyUtil.PlaySound(SoundType.Error);
return;
}
else
{
last.Weight = weight;
CarcassInStoreBL.Update(last.ID, "Weight", weight);
needSubmitedList.Remove(last);
needSubmitGrid.Refresh();
historyList.Insert(0, last);
historyDataGrid.Refresh();
SoundPalyUtil.PlaySound(SoundType.ShotSucc);
}
}));
};
} }
void SyncBaseInfo()
void LoadBind()
{ {
if (netStateWatch1.NetState)
this.Invoke(new Action(() =>
{ {
BaseInfoSyncRpc.SyncGoodsByTag(ApplyClient.);
BaseInfoSyncRpc.SyncBaseInfo<WorkUnit>();
BaseInfoSyncRpc.SyncBaseInfo<ProductBatch>();
if (netStateWatch1.NetState)
{
BaseInfoSyncRpc.SyncGoodsByTag(ApplyClient.);
BaseInfoSyncRpc.SyncBaseInfo<WorkUnit>();
BaseInfoSyncRpc.SyncBaseInfo<ProductBatch>();
}
workUnitSelect.EBindComboBox<WorkUnit>();
productBatchSelect.EBindComboBox<ProductBatch>();
BindGoods();
BindGrid();
}));
}
void BindGoods()
{
var goods = CarcassInStoreBL.GetGoodsList();
foreach (var item in goods)
{
for (var i = 0; i < 10; i++)
{
var btn = new UButton() { Width = 90, Height = 50, Text = item.Goods_Name, Tag = item.ID, Font = new Font("宋体", 15), Margin = new Padding(8, 14, 8, 0), PlaySound = true };
flowLayoutPanel1.Controls.Add(btn);
}
} }
}
workUnitSelect.EBindComboBox<WorkUnit>();
productBatchSelect.EBindComboBox<ProductBatch>();
void BindGrid()
{
needSubmitedList = CarcassInStoreBL.GetLocalDataWithState(false);
needSubmitGrid.DataSource = needSubmitedList;
needSubmitGrid.Refresh();
historyList = CarcassInStoreBL.GetLocalDataWithState(true);
historyDataGrid.DataSource = historyList;
historyDataGrid.Refresh();
} }
public List<short> RoleName
void SyncPadData()
{ {
get { return new List<short> { (short). }; }
while (true)
{
if (this.IsHandleCreated)
{
this.Invoke(new Action(() =>
{
if (netStateWatch1.NetState)
{
var list = CarcassInStoreBL.DoWithPadData((long?)workUnitSelect.SelectedValue, (long?)productBatchSelect.SelectedValue);
if (list.Any())
{
bool n1 = false;
bool n2 = false;
foreach (var item in list)
{
if (string.IsNullOrEmpty(item.BarCode))
{
var hf = historyList.FirstOrDefault(x => x.ID == item.ID);
if (hf != null)
{
hf.Goods_Name = item.Goods_Name;
n2 = true;
}
else
{
var uf = needSubmitedList.FirstOrDefault(x => x.ID == item.ID);
if (uf != null)
{
uf.Goods_Name = item.Goods_Name;
n1 = true;
}
}
}
else
{
needSubmitedList.Add(item);
var old = needSubmitedList.OrderByDescending(x => x.ID).ToList();
needSubmitedList.Clear();
old.ForEach(x => needSubmitedList.Add(x));
n1 = true;
}
}
if (n1)
needSubmitGrid.Refresh();
if (n2)
historyDataGrid.Refresh();
}
}
}));
}
Thread.Sleep(2000);
}
} }
public Form Generate()
private void closeBtn_Click(object sender, EventArgs e)
{ {
return this;
Close();
} }
} }
} }

+ 10
- 34
ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.resx View File

@ -117,12 +117,6 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="splitContainer1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="closeBtn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="closeBtn.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="closeBtn.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
@ -132,52 +126,34 @@
KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII=
</value> </value>
</data> </data>
<metadata name="uTimerLabel1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="productBatchSelect.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="workUnitSelect.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="uScanPanel1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="netStateWatch1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="uWeightControl1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="uLabel1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="H_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="uLabel2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="H_BarCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="splitContainer2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="H_Goods_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="groupBox2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="H_Weight.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="historyDataGrid.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="H_BeforeWeight.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="uLabel4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="H_Discont.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="groupBox1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="U_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="needSubmitGrid.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="U_BarCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="uLabel3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="U_Goods_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="U_Weight.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
</root> </root>

+ 3
- 0
ButcherFactory.Login/Login.Designer.cs View File

@ -69,6 +69,7 @@
// //
this.exitBtn.BackgroundImage = global::ButcherFactory.Login.Properties.Resources.cancelBtn; this.exitBtn.BackgroundImage = global::ButcherFactory.Login.Properties.Resources.cancelBtn;
this.exitBtn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.exitBtn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.exitBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.exitBtn.FlatAppearance.BorderSize = 0; this.exitBtn.FlatAppearance.BorderSize = 0;
this.exitBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.exitBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.exitBtn.Font = new System.Drawing.Font("黑体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.exitBtn.Font = new System.Drawing.Font("黑体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@ -127,9 +128,11 @@
// //
// Login // Login
// //
this.AcceptButton = this.loginBtn;
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.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage"))); this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.CancelButton = this.exitBtn;
this.ClientSize = new System.Drawing.Size(676, 385); this.ClientSize = new System.Drawing.Size(676, 385);
this.Controls.Add(this.userNameBox); this.Controls.Add(this.userNameBox);
this.Controls.Add(this.pwdBox); this.Controls.Add(this.pwdBox);


Loading…
Cancel
Save