From 5f4a80e602308a5099362831a5bde3b991f64543 Mon Sep 17 00:00:00 2001
From: yibo <361071264@qq.com>
Date: Fri, 20 Apr 2018 22:57:15 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ButcherFactory.BO/Bill/CarcassInStore.cs | 2 +-
.../Bill/CarcassTakeOutWeightTemp.cs | 18 +
ButcherFactory.BO/ButcherFactory.BO.csproj | 2 +
ButcherFactory.BO/LocalBL/CarcassInStoreBL.cs | 146 ++++----
.../LocalBL/CarcassInStoreBLOld.cs | 324 +++++++++++++++++
ButcherFactory.BO/LocalBL/CarcassTakeOutBL.cs | 64 ++--
.../ButcherFactory.Form.csproj | 1 +
.../CarcassInStoreForm.Designer.cs | 162 ++++-----
.../CarcassInStore_/CarcassInStoreForm.cs | 129 +++----
.../CarcassInStore_/CarcassInStoreForm.resx | 8 -
.../CarcassInStore_/CarcassInStoreFormOld.cs | 329 ++++++++++++++++++
.../CarcassTakeOutForm.Designer.cs | 317 +++++++++++------
.../CarcassTakeOut_/CarcassTakeOutForm.cs | 80 +++--
.../CarcassTakeOut_/CarcassTakeOutForm.resx | 30 +-
14 files changed, 1161 insertions(+), 451 deletions(-)
create mode 100644 ButcherFactory.BO/Bill/CarcassTakeOutWeightTemp.cs
create mode 100644 ButcherFactory.BO/LocalBL/CarcassInStoreBLOld.cs
create mode 100644 ButcherFactory.Form/CarcassInStore_/CarcassInStoreFormOld.cs
diff --git a/ButcherFactory.BO/Bill/CarcassInStore.cs b/ButcherFactory.BO/Bill/CarcassInStore.cs
index 3e3463a..fb5ec32 100644
--- a/ButcherFactory.BO/Bill/CarcassInStore.cs
+++ b/ButcherFactory.BO/Bill/CarcassInStore.cs
@@ -19,7 +19,7 @@ namespace ButcherFactory.BO
public long? ProductBatch_ID { get; set; }
- public long Goods_ID { get; set; }
+ public long? Goods_ID { get; set; }
public decimal? Weight { get; set; }
diff --git a/ButcherFactory.BO/Bill/CarcassTakeOutWeightTemp.cs b/ButcherFactory.BO/Bill/CarcassTakeOutWeightTemp.cs
new file mode 100644
index 0000000..463e5ef
--- /dev/null
+++ b/ButcherFactory.BO/Bill/CarcassTakeOutWeightTemp.cs
@@ -0,0 +1,18 @@
+using Forks.EnterpriseServices.DomainObjects2;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ButcherFactory.BO
+{
+ [MapToTable("Butcher_CarcassTakeOutWeightTemp")]
+ [KeyField("ID", KeyGenType.identity)]
+ public class CarcassTakeOutWeightTemp
+ {
+ public long ID { get; set; }
+
+ public decimal Weight { get; set; }
+ }
+}
diff --git a/ButcherFactory.BO/ButcherFactory.BO.csproj b/ButcherFactory.BO/ButcherFactory.BO.csproj
index f4f25d7..9987a72 100644
--- a/ButcherFactory.BO/ButcherFactory.BO.csproj
+++ b/ButcherFactory.BO/ButcherFactory.BO.csproj
@@ -62,6 +62,7 @@
+
@@ -71,6 +72,7 @@
+
diff --git a/ButcherFactory.BO/LocalBL/CarcassInStoreBL.cs b/ButcherFactory.BO/LocalBL/CarcassInStoreBL.cs
index c64d8bb..e0fac6f 100644
--- a/ButcherFactory.BO/LocalBL/CarcassInStoreBL.cs
+++ b/ButcherFactory.BO/LocalBL/CarcassInStoreBL.cs
@@ -18,88 +18,94 @@ namespace ButcherFactory.BO.LocalBL
{
const string RpcPath = @"/MainSystem/B3ClientService/Rpcs/CarcassInStoreRpc/";
static Dictionary _goodsNames = new Dictionary();
- public static List DoWithPadData(long? workUnitID, long? batchID)
+ public static void DoWithPadData(IEnumerable list)
{
try
{
var json = RpcFacade.Call(RpcPath + "GetUnSyncPadData");
var data = JsonConvert.DeserializeObject>(json);
- var list = new List();
if (data.Count == 0)
- return list;
+ return;
- var goodsBarCode = data.Select(x => new Tuple(x.Goods_ID, x.BarCode));
- list = InsertOrUpdate(workUnitID, batchID, goodsBarCode, true);
-
- var backInfo = data.Select(x => new ExtensionObj { LongExt1 = x.ID, DecimalExt1 = x.RowVersion });
+ var back = new List>();
+ using (var session = DmoSession.New())
+ {
+ foreach (var item in list)
+ {
+ var first = data.FirstOrDefault();
+ if (first == null)
+ break;
+ if (CheckExist(first.BarCode, session))
+ continue;
+ back.Add(new Tuple(first.ID, first.RowVersion));
+ Update(item.ID, session, new Tuple("Goods_ID", first.Goods_ID), new Tuple("BarCode", first.BarCode), new Tuple("FromPad", true));
+ item.Goods_ID = first.Goods_ID;
+ item.Goods_Name = GetGoodsName(item.Goods_ID.Value, session);
+ item.BarCode = first.BarCode;
+ }
+ session.Commit();
+ }
+ if (back.Count == 0)
+ return;
+ var backInfo = back.Select(x => new ExtensionObj { LongExt1 = x.Item1, DecimalExt1 = x.Item2 });
RpcFacade.Call(RpcPath + "SetPadDataSync", JsonConvert.SerializeObject(backInfo));
- return list;
}
catch
{
#if DEBUG
throw;
#endif
- return new List();
}
}
- public static List InsertOrUpdate(long? workUnitID, long? batchID, long goodsID, string barCode)
- {
- var list = new List> { new Tuple(goodsID, barCode) };
- return InsertOrUpdate(workUnitID, batchID, list, false);
- }
-
- static List InsertOrUpdate(long? workUnitID, long? batchID, IEnumerable> data, bool fromPad)
+ public static CarcassInStore Insert(long? workUnit, long? productBatch, decimal weight)
{
- var list = new List();
using (var session = DmoSession.New())
{
- foreach (var item in data)
+ var entity = new CarcassInStore();
+ entity.WorkUnit_ID = workUnit;
+ if (productBatch.HasValue)
{
- var idWeight = GetExistWithUpdate(item, session);
- if (idWeight != null)
- {
- var exist = new CarcassInStore();
- list.Add(exist);
- exist.ID = idWeight.Item1;
- exist.Goods_ID = item.Item1;
- exist.Goods_Name = GetGoodsName(item.Item1, session);
- exist.Weight = idWeight.Item2;
- }
- else
- {
- var entity = CreateCarcassInStore(workUnitID, batchID, item, fromPad);
- entity.Goods_Name = GetGoodsName(item.Item1, session);
- if (batchID.HasValue)
- entity.RowIndex = GetRowIndex(session, batchID.Value) + 1;
- session.Insert(entity);
- list.Add(entity);
- }
+ entity.ProductBatch_ID = productBatch;
+ entity.RowIndex = GenerateRowIndex(session, productBatch.Value);
}
+ entity.UserID = AppContext.Worker.ID;
+ entity.Weight = weight;
+
+ session.Insert(entity);
session.Commit();
+ return entity;
}
- return list;
}
- static int GetRowIndex(IDmoSession session, long batchID)
+ static bool CheckExist(string barCode, IDmoSession session)
{
+ if (string.IsNullOrEmpty(barCode))
+ return false;
var query = new DQueryDom(new JoinAlias(typeof(CarcassInStore)));
- query.Columns.Add(DQSelectColumn.Max("RowIndex"));
- query.Where.Conditions.Add(DQCondition.EQ("ProductBatch_ID", batchID));
- return query.EExecuteScalar(session) ?? 0;
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Value(1), "c"));
+ query.Where.Conditions.Add(DQCondition.EQ("BarCode", barCode));
+ return query.EExecuteScalar(session) != null;
}
- static CarcassInStore CreateCarcassInStore(long? workUnitID, long? batchID, Tuple goodsCode, bool fromPad)
+ public static void Update(long id, long goodsID, string barCode)
{
- var entity = new CarcassInStore();
- entity.FromPad = fromPad;
- entity.WorkUnit_ID = workUnitID;
- entity.ProductBatch_ID = batchID;
- entity.UserID = AppContext.Worker.ID;
- entity.BarCode = goodsCode.Item2;
- entity.Goods_ID = goodsCode.Item1;
- return entity;
+ using (var session = DmoSession.New())
+ {
+ var exist = CheckExist(barCode, session);
+ if (exist)
+ throw new Exception("条码已使用过");
+ Update(id, session, new Tuple("Goods_ID", goodsID), new Tuple("BarCode", barCode));
+ session.Commit();
+ }
+ }
+
+ static int GenerateRowIndex(IDmoSession session, long batchID)
+ {
+ var query = new DQueryDom(new JoinAlias(typeof(CarcassInStore)));
+ query.Columns.Add(DQSelectColumn.Max("RowIndex"));
+ query.Where.Conditions.Add(DQCondition.EQ("ProductBatch_ID", batchID));
+ return (query.EExecuteScalar(session) ?? 0) + 1;
}
static string GetGoodsName(long id, IDmoSession session)
@@ -114,40 +120,17 @@ namespace ButcherFactory.BO.LocalBL
return _goodsNames[id];
}
- static Tuple GetExistWithUpdate(Tuple goodsCode, IDmoSession session)
- {
- if (string.IsNullOrEmpty(goodsCode.Item2))
- return null;
- var query = new DQueryDom(new JoinAlias(typeof(CarcassInStore)));
- query.Columns.Add(DQSelectColumn.Field("ID"));
- query.Columns.Add(DQSelectColumn.Field("Weight"));
- query.Where.Conditions.Add(DQCondition.EQ("BarCode", goodsCode.Item2));
- var result = query.EExecuteScalar();
- if (result == null)
- return null;
- Update(result.Item1, "Goods_ID", goodsCode.Item1, session);
- return result;
- }
-
- static void Update(long id, string fileName, object value, IDmoSession session)
+ static void Update(long id, IDmoSession session, params Tuple[] values)
{
var update = new DQUpdateDom(typeof(CarcassInStore));
update.Where.Conditions.Add(DQCondition.EQ("ID", id));
- update.Columns.Add(new DQUpdateColumn(fileName, value));
+ foreach (var item in values)
+ update.Columns.Add(new DQUpdateColumn(item.Item1, item.Item2));
update.Columns.Add(new DQUpdateColumn("Sync", false));
update.Columns.Add(new DQUpdateColumn("RowVersion", DQExpression.Add(DQExpression.Field("RowVersion"), DQExpression.Value(1))));
session.ExecuteNonQuery(update);
}
- public static void Update(long id, string fileName, object value)
- {
- using (var session = DmoSession.New())
- {
- Update(id, fileName, value, session);
- session.Commit();
- }
- }
-
public static BindingList GetLocalDataWithState(bool history)
{
var query = new DQueryDom(new JoinAlias(typeof(CarcassInStore)));
@@ -159,11 +142,11 @@ namespace ButcherFactory.BO.LocalBL
{
query.Columns.Add(DQSelectColumn.Field("Weight"));
query.Columns.Add(DQSelectColumn.Field("BeforeWeight"));
- query.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field("Weight")));
+ query.Where.Conditions.Add(DQCondition.And(DQCondition.IsNotNull(DQExpression.Field("Goods_ID")), DQCondition.IsNotNull(DQExpression.Field("Weight"))));
query.Range = SelectRange.Top(30);
}
else
- query.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field("Weight")));
+ query.Where.Conditions.Add(DQCondition.Or(DQCondition.IsNull(DQExpression.Field("Goods_ID")), DQCondition.IsNull(DQExpression.Field("Weight"))));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true));
var result = new BindingList();
using (var session = DmoSession.New())
@@ -263,7 +246,7 @@ namespace ButcherFactory.BO.LocalBL
static List GetUnSyncData(IDmoSession session)
{
- var query = new DQueryDom(new JoinAlias("_main",typeof(CarcassInStore)));
+ var query = new DQueryDom(new JoinAlias("_main", typeof(CarcassInStore)));
query.Columns.Add(DQSelectColumn.Field("ID"));
query.Columns.Add(DQSelectColumn.Field("RowVersion"));
query.Columns.Add(DQSelectColumn.Field("BarCode"));
@@ -275,6 +258,7 @@ namespace ButcherFactory.BO.LocalBL
query.Columns.Add(DQSelectColumn.Field("CreateTime"));
query.Where.Conditions.Add(DQCondition.And(
//DQExpression.Snippet("[_main].[BarCode] != ''"),
+ DQCondition.IsNotNull(DQExpression.Field("Goods_ID")),
DQCondition.IsNotNull(DQExpression.Field("Weight")), DQCondition.EQ("Sync", false)));
query.Range = SelectRange.Top(10);
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID"));
@@ -305,7 +289,7 @@ namespace ButcherFactory.BO.LocalBL
var update = new DQUpdateDom(typeof(CarcassInStore));
update.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("ID", obj.ID), DQCondition.EQ("RowVersion", obj.RowVersion)));
update.Columns.Add(new DQUpdateColumn("Sync", true));
- update.EExecute();
+ session.ExecuteNonQuery(update);
}
}
diff --git a/ButcherFactory.BO/LocalBL/CarcassInStoreBLOld.cs b/ButcherFactory.BO/LocalBL/CarcassInStoreBLOld.cs
new file mode 100644
index 0000000..b64c114
--- /dev/null
+++ b/ButcherFactory.BO/LocalBL/CarcassInStoreBLOld.cs
@@ -0,0 +1,324 @@
+using ButcherFactory.BO.Utils;
+using Forks.EnterpriseServices.DomainObjects2;
+using Forks.EnterpriseServices.DomainObjects2.DQuery;
+using Forks.EnterpriseServices.SqlDoms;
+using Forks.JsonRpc.Client;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using TSingSoft.WebPluginFramework;
+
+namespace ButcherFactory.BO.LocalBL
+{
+ public static class CarcassInStoreBLOld
+ {
+ const string RpcPath = @"/MainSystem/B3ClientService/Rpcs/CarcassInStoreRpc/";
+ static Dictionary _goodsNames = new Dictionary();
+ public static List DoWithPadData(long? workUnitID, long? batchID)
+ {
+ try
+ {
+ var json = RpcFacade.Call(RpcPath + "GetUnSyncPadData");
+ var data = JsonConvert.DeserializeObject>(json);
+ var list = new List();
+ if (data.Count == 0)
+ return list;
+
+ var goodsBarCode = data.Select(x => new Tuple(x.Goods_ID, x.BarCode));
+ list = InsertOrUpdate(workUnitID, batchID, goodsBarCode, true);
+
+ var backInfo = data.Select(x => new ExtensionObj { LongExt1 = x.ID, DecimalExt1 = x.RowVersion });
+ RpcFacade.Call(RpcPath + "SetPadDataSync", JsonConvert.SerializeObject(backInfo));
+ return list;
+ }
+ catch
+ {
+#if DEBUG
+ throw;
+#endif
+ return new List();
+ }
+ }
+
+ public static List InsertOrUpdate(long? workUnitID, long? batchID, long goodsID, string barCode)
+ {
+ var list = new List> { new Tuple(goodsID, barCode) };
+ return InsertOrUpdate(workUnitID, batchID, list, false);
+ }
+
+ static List InsertOrUpdate(long? workUnitID, long? batchID, IEnumerable> data, bool fromPad)
+ {
+ var list = new List();
+ using (var session = DmoSession.New())
+ {
+ foreach (var item in data)
+ {
+ var idWeight = GetExistWithUpdate(item, session);
+ if (idWeight != null)
+ {
+ var exist = new CarcassInStore();
+ list.Add(exist);
+ exist.ID = idWeight.Item1;
+ exist.Goods_ID = item.Item1;
+ exist.Goods_Name = GetGoodsName(item.Item1, session);
+ exist.Weight = idWeight.Item2;
+ }
+ else
+ {
+ var entity = CreateCarcassInStore(workUnitID, batchID, item, fromPad);
+ entity.Goods_Name = GetGoodsName(item.Item1, session);
+ if (batchID.HasValue)
+ entity.RowIndex = GetRowIndex(session, batchID.Value) + 1;
+ session.Insert(entity);
+ list.Add(entity);
+ }
+ }
+ session.Commit();
+ }
+ return list;
+ }
+
+ static int GetRowIndex(IDmoSession session, long batchID)
+ {
+ var query = new DQueryDom(new JoinAlias(typeof(CarcassInStore)));
+ query.Columns.Add(DQSelectColumn.Max("RowIndex"));
+ query.Where.Conditions.Add(DQCondition.EQ("ProductBatch_ID", batchID));
+ return query.EExecuteScalar(session) ?? 0;
+ }
+
+ static CarcassInStore CreateCarcassInStore(long? workUnitID, long? batchID, Tuple goodsCode, bool fromPad)
+ {
+ var entity = new CarcassInStore();
+ entity.FromPad = fromPad;
+ entity.WorkUnit_ID = workUnitID;
+ entity.ProductBatch_ID = batchID;
+ entity.UserID = AppContext.Worker.ID;
+ entity.BarCode = goodsCode.Item2;
+ entity.Goods_ID = goodsCode.Item1;
+ return entity;
+ }
+
+ 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(session));
+ }
+ return _goodsNames[id];
+ }
+
+ static Tuple GetExistWithUpdate(Tuple goodsCode, IDmoSession session)
+ {
+ if (string.IsNullOrEmpty(goodsCode.Item2))
+ return null;
+ var query = new DQueryDom(new JoinAlias(typeof(CarcassInStore)));
+ query.Columns.Add(DQSelectColumn.Field("ID"));
+ query.Columns.Add(DQSelectColumn.Field("Weight"));
+ query.Where.Conditions.Add(DQCondition.EQ("BarCode", goodsCode.Item2));
+ var result = query.EExecuteScalar();
+ if (result == null)
+ return null;
+ Update(result.Item1, "Goods_ID", goodsCode.Item1, session);
+ return result;
+ }
+
+ static void Update(long id, string fileName, object value, IDmoSession session)
+ {
+ var update = new DQUpdateDom(typeof(CarcassInStore));
+ update.Where.Conditions.Add(DQCondition.EQ("ID", id));
+ update.Columns.Add(new DQUpdateColumn(fileName, value));
+ update.Columns.Add(new DQUpdateColumn("Sync", false));
+ update.Columns.Add(new DQUpdateColumn("RowVersion", DQExpression.Add(DQExpression.Field("RowVersion"), DQExpression.Value(1))));
+ session.ExecuteNonQuery(update);
+ }
+
+ public static void Update(long id, string fileName, object value)
+ {
+ using (var session = DmoSession.New())
+ {
+ Update(id, fileName, value, session);
+ session.Commit();
+ }
+ }
+
+ public static BindingList GetLocalDataWithState(bool history)
+ {
+ var query = new DQueryDom(new JoinAlias(typeof(CarcassInStore)));
+ query.Columns.Add(DQSelectColumn.Field("RowIndex"));
+ query.Columns.Add(DQSelectColumn.Field("ID"));
+ query.Columns.Add(DQSelectColumn.Field("BarCode"));
+ query.Columns.Add(DQSelectColumn.Field("Goods_Name"));
+ if (history)
+ {
+ query.Columns.Add(DQSelectColumn.Field("Weight"));
+ query.Columns.Add(DQSelectColumn.Field("BeforeWeight"));
+ query.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field("Weight")));
+ query.Range = SelectRange.Top(30);
+ }
+ else
+ query.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field("Weight")));
+ query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true));
+ var result = new BindingList();
+ using (var session = DmoSession.New())
+ {
+ using (var reader = session.ExecuteReader(query))
+ {
+ while (reader.Read())
+ {
+ var entity = new CarcassInStore();
+ result.Add(entity);
+ entity.RowIndex = (int?)reader[0];
+ entity.ID = (long)reader[1];
+ entity.BarCode = (string)reader[2];
+ entity.Goods_Name = (string)reader[3];
+ if (history)
+ {
+ entity.Weight = (decimal)reader[4];
+ entity.BeforeWeight = (decimal?)reader[5];
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ public static IEnumerable GetGoodsList()
+ {
+ var main = new JoinAlias(typeof(ClientGoodsSet));
+ var detail = new JoinAlias(typeof(ClientGoodsSet_Detail));
+ var query = new DQueryDom(main);
+ query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "ClientGoodsSet_ID"));
+ query.Columns.Add(DQSelectColumn.Field("Goods_ID", detail));
+ query.Columns.Add(DQSelectColumn.Field("Goods_Name", detail));
+ query.OrderBy.Expressions.Add(DQOrderByExpression.Create(detail, "Goods_ID"));
+ var list = query.EExecuteList();
+ return list.Select(x => new ClientGoodsSet_Detail { Goods_ID = x.Item1, Goods_Name = x.Item2 });
+ }
+
+ public static List GetBeforeWeight(IEnumerable codeList)
+ {
+ try
+ {
+ var json = RpcFacade.Call(RpcPath + "GetWeightInfo", codeList);
+ var list = JsonConvert.DeserializeObject>(json);
+ if (list.Any())
+ {
+ using (var session = DmoSession.New())
+ {
+ foreach (var item in list)
+ SaveWeightInDB(item, session);
+ session.Commit();
+ }
+ }
+ return list;
+ }
+ catch
+ {
+#if DEBUG
+ throw;
+#endif
+ return new List();
+ }
+ }
+
+ static void SaveWeightInDB(ExtensionObj obj, IDmoSession session)
+ {
+ var update = new DQUpdateDom(typeof(CarcassInStore));
+ update.Where.Conditions.Add(DQCondition.EQ("BarCode", obj.StringExt1));
+ update.Columns.Add(new DQUpdateColumn("BeforeWeight", obj.DecimalExt1));
+ session.ExecuteNonQuery(update);
+ }
+
+ public static void UploadCarcassInfo()
+ {
+ try
+ {
+ using (var session = DmoSession.New())
+ {
+ var needUpload = GetUnSyncData(session);
+ if (needUpload.Count == 0)
+ return;
+
+ var json = JsonConvert.SerializeObject(needUpload);
+ RpcFacade.Call(RpcPath + "UploadCarcassInfo", json);
+ foreach (var item in needUpload)
+ SetLocalAsSyncd(item, session);
+ session.Commit();
+ }
+ }
+ catch
+ {
+#if DEBUG
+ throw;
+#endif
+ }
+ }
+
+ static List GetUnSyncData(IDmoSession session)
+ {
+ var query = new DQueryDom(new JoinAlias("_main", typeof(CarcassInStore)));
+ query.Columns.Add(DQSelectColumn.Field("ID"));
+ query.Columns.Add(DQSelectColumn.Field("RowVersion"));
+ query.Columns.Add(DQSelectColumn.Field("BarCode"));
+ query.Columns.Add(DQSelectColumn.Field("UserID"));
+ query.Columns.Add(DQSelectColumn.Field("WorkUnit_ID"));
+ query.Columns.Add(DQSelectColumn.Field("ProductBatch_ID"));
+ query.Columns.Add(DQSelectColumn.Field("Goods_ID"));
+ query.Columns.Add(DQSelectColumn.Field("Weight"));
+ query.Columns.Add(DQSelectColumn.Field("CreateTime"));
+ query.Where.Conditions.Add(DQCondition.And(
+ //DQExpression.Snippet("[_main].[BarCode] != ''"),
+ DQCondition.IsNotNull(DQExpression.Field("Weight")), DQCondition.EQ("Sync", false)));
+ query.Range = SelectRange.Top(10);
+ query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID"));
+
+ var upload = new List();
+ using (var reader = session.ExecuteReader(query))
+ {
+ while (reader.Read())
+ {
+ var obj = new CarcassInStoreObj();
+ obj.ID = (long)reader[0];
+ obj.RowVersion = (int)reader[1];
+ obj.BarCode = (string)reader[2];
+ obj.InStoreWorker_ID = (long)reader[3];
+ obj.WorkUnit_ID = (long?)reader[4];
+ obj.ProductBatch_ID = (long?)reader[5];
+ obj.InStoreGoods_ID = (long)reader[6];
+ obj.InStoreWeight = (decimal)reader[7];
+ obj.InStoreTime = (DateTime)reader[8];
+ upload.Add(obj);
+ }
+ }
+ return upload;
+ }
+
+ static void SetLocalAsSyncd(CarcassInStoreObj obj, IDmoSession session)
+ {
+ var update = new DQUpdateDom(typeof(CarcassInStore));
+ update.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("ID", obj.ID), DQCondition.EQ("RowVersion", obj.RowVersion)));
+ update.Columns.Add(new DQUpdateColumn("Sync", true));
+ update.EExecute();
+ }
+ }
+
+ //class CarcassInStoreObj
+ //{
+ // public long ID { get; set; }
+ // public int RowVersion { get; set; }
+ // public string BarCode { get; set; }
+ // public long? InStoreWorker_ID { get; set; }
+ // public long? WorkUnit_ID { get; set; }
+ // public long? ProductBatch_ID { get; set; }
+ // public long? InStoreGoods_ID { get; set; }
+ // public decimal? InStoreWeight { get; set; }
+ // public DateTime? InStoreTime { get; set; }
+ //}
+}
diff --git a/ButcherFactory.BO/LocalBL/CarcassTakeOutBL.cs b/ButcherFactory.BO/LocalBL/CarcassTakeOutBL.cs
index fb13478..bd30c86 100644
--- a/ButcherFactory.BO/LocalBL/CarcassTakeOutBL.cs
+++ b/ButcherFactory.BO/LocalBL/CarcassTakeOutBL.cs
@@ -29,7 +29,7 @@ namespace ButcherFactory.BO.LocalBL
entity.WorkUnit_ID = workUnitID;
entity.BarCode = barCode;
entity.UserID = AppContext.Worker.ID;
- entity.RowIndex = GetRowIndex(session) + 1;
+ entity.RowIndex = GenerateRowIndex(session);
session.Insert(entity);
isNew = true;
}
@@ -44,20 +44,22 @@ namespace ButcherFactory.BO.LocalBL
}
}
- static int GetRowIndex(IDmoSession session)
+ static int GenerateRowIndex(IDmoSession session)
{
var query = new DQueryDom(new JoinAlias("_main", typeof(CarcassTakeOut)));
query.Columns.Add(DQSelectColumn.Max("RowIndex"));
query.Where.Conditions.Add(DQCondition.EQ(DQExpression.Snippet("CAST([_main].[CreateTime] AS DATE)"), DQExpression.Value(DateTime.Today)));
- return query.EExecuteScalar(session) ?? 0;
+ return (query.EExecuteScalar(session) ?? 0) + 1;
}
private static CarcassTakeOut GetEntityByBarCode(string barCode, IDmoSession session)
{
+ if (string.IsNullOrEmpty(barCode))
+ return null;
var query = new DQueryDom(new JoinAlias(typeof(CarcassTakeOut)));
query.Columns.Add(DQSelectColumn.Field("ID"));
query.Columns.Add(DQSelectColumn.Field("WorkUnit_ID"));
- query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("BarCode", barCode), DQCondition.EQ("Delete", false)));
+ query.Where.Conditions.Add(DQCondition.EQ("BarCode", barCode));
var item = query.EExecuteScalar();
if (item == null)
return null;
@@ -75,12 +77,25 @@ namespace ButcherFactory.BO.LocalBL
session.ExecuteNonQuery(update);
}
- public static void Delete(long id)
+ public static BindingList GetWeightList()
+ {
+ var query = new DQueryDom(new JoinAlias(typeof(CarcassTakeOutWeightTemp)));
+ query.Columns.Add(DQSelectColumn.Field("ID"));
+ query.Columns.Add(DQSelectColumn.Field("Weight"));
+ query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true));
+ var result = new BindingList();
+ query.EExecuteList().ForEach(x => result.Add(new CarcassTakeOutWeightTemp { ID = x.Item1, Weight = x.Item2 }));
+ return result;
+ }
+
+ public static CarcassTakeOutWeightTemp InsertWeight(decimal weight)
{
using (var session = DmoSession.New())
{
- Update(id, session, new Tuple("Delete", true));
+ var entity = new CarcassTakeOutWeightTemp { Weight = weight };
+ session.Insert(entity);
session.Commit();
+ return entity;
}
}
@@ -95,7 +110,7 @@ namespace ButcherFactory.BO.LocalBL
query.Columns.Add(DQSelectColumn.Field("Weight"));
if (history)
query.Range = SelectRange.Top(30);
- query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Submited", history), DQCondition.EQ("Delete", false)));
+ query.Where.Conditions.Add(DQCondition.EQ("Submited", history));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true));
var result = new BindingList();
using (var session = DmoSession.New())
@@ -118,17 +133,6 @@ namespace ButcherFactory.BO.LocalBL
return result;
}
- public static void SetWeight(IEnumerable ids, decimal weight)
- {
- var id = ids.Max();
- using (var session = DmoSession.New())
- {
- Update(id, session, new Tuple("GroupID", id), new Tuple("Weight", weight));
- GroupUpdate(ids.Where(x => x != id), session, new Tuple("GroupID", id), new Tuple("Weight", 0));
- session.Commit();
- }
- }
-
static void GroupUpdate(IEnumerable ids, IDmoSession session, params Tuple[] updates)
{
if (ids.Count() == 0)
@@ -142,11 +146,27 @@ namespace ButcherFactory.BO.LocalBL
session.ExecuteNonQuery(update);
}
- public static void Submit(IEnumerable ids)
+ public static void Submit(decimal weight, List list)
{
using (var session = DmoSession.New())
{
+ var ids = list.Select(x => x.ID);
+ var id = list.Max(x => x.ID);
+
+ Update(id, session, new Tuple("GroupID", id), new Tuple("Weight", weight));
+ GroupUpdate(ids.Where(x => x != id), session, new Tuple("GroupID", id), new Tuple("Weight", 0));
+
+ foreach (var item in list)
+ {
+ if (item.ID == id)
+ item.Weight = weight;
+ else
+ item.Weight = 0;
+ }
+
GroupUpdate(ids, session, new Tuple("Submited", true));
+ var sql = @"truncate table [Butcher_CarcassTakeOutWeightTemp];";
+ session.ExecuteSqlNonQuery(sql);
session.Commit();
}
}
@@ -173,7 +193,8 @@ namespace ButcherFactory.BO.LocalBL
#if DEBUG
throw;
#endif
- return new List(); }
+ return new List();
+ }
}
private static void SaveBeforeInfoInDB(ExtensionObj obj, IDmoSession session)
@@ -202,7 +223,8 @@ namespace ButcherFactory.BO.LocalBL
session.Commit();
}
}
- catch {
+ catch
+ {
#if DEBUG
throw;
#endif
diff --git a/ButcherFactory.Form/ButcherFactory.Form.csproj b/ButcherFactory.Form/ButcherFactory.Form.csproj
index d105651..0a088ff 100644
--- a/ButcherFactory.Form/ButcherFactory.Form.csproj
+++ b/ButcherFactory.Form/ButcherFactory.Form.csproj
@@ -58,6 +58,7 @@
CarcassInStoreForm.cs
+
diff --git a/ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.Designer.cs b/ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.Designer.cs
index 9d4b946..03e5526 100644
--- a/ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.Designer.cs
+++ b/ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.Designer.cs
@@ -32,17 +32,16 @@
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = 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 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 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 dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.lowWeight = new WinFormControl.UTextBoxWithPad();
this.noWeightBtn = new WinFormControl.UButton();
- this.noCodeBtn = new WinFormControl.UButton();
this.closeBtn = new WinFormControl.UButton();
this.uTimerLabel1 = new WinFormControl.UTimerLabel();
this.productBatchSelect = new System.Windows.Forms.ComboBox();
@@ -56,6 +55,13 @@
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.historyDataGrid = new WinFormControl.UDataGridView();
+ this.H_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.H_RowIndex = 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();
this.uLabel4 = new WinFormControl.ULabel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.needSubmitGrid = new WinFormControl.UDataGridView();
@@ -65,13 +71,6 @@
this.U_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.uLabel3 = new WinFormControl.ULabel();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
- this.H_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.H_RowIndex = 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();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -102,7 +101,6 @@
this.splitContainer1.Panel1.BackColor = System.Drawing.Color.Transparent;
this.splitContainer1.Panel1.Controls.Add(this.lowWeight);
this.splitContainer1.Panel1.Controls.Add(this.noWeightBtn);
- this.splitContainer1.Panel1.Controls.Add(this.noCodeBtn);
this.splitContainer1.Panel1.Controls.Add(this.closeBtn);
this.splitContainer1.Panel1.Controls.Add(this.uTimerLabel1);
this.splitContainer1.Panel1.Controls.Add(this.productBatchSelect);
@@ -150,27 +148,6 @@
this.noWeightBtn.WithStataHode = false;
this.noWeightBtn.Click += new System.EventHandler(this.noWeightBtn_Click);
//
- // noCodeBtn
- //
- this.noCodeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.noCodeBtn.AsClicked = false;
- this.noCodeBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("noCodeBtn.BackgroundImage")));
- this.noCodeBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214)))));
- this.noCodeBtn.FlatAppearance.BorderSize = 0;
- this.noCodeBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.noCodeBtn.Font = new System.Drawing.Font("宋体", 15F);
- this.noCodeBtn.ForeColor = System.Drawing.Color.Black;
- this.noCodeBtn.Location = new System.Drawing.Point(567, 44);
- this.noCodeBtn.Name = "noCodeBtn";
- this.noCodeBtn.PlaySound = false;
- this.noCodeBtn.Size = new System.Drawing.Size(111, 34);
- this.noCodeBtn.SoundType = WinFormControl.SoundType.Click;
- this.noCodeBtn.TabIndex = 10;
- this.noCodeBtn.Text = "无 码";
- this.noCodeBtn.UseVisualStyleBackColor = true;
- this.noCodeBtn.WithStataHode = true;
- this.noCodeBtn.Click += new System.EventHandler(this.noCodeBtn_Click);
- //
// closeBtn
//
this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -361,6 +338,65 @@
this.historyDataGrid.Size = new System.Drawing.Size(638, 230);
this.historyDataGrid.TabIndex = 2;
//
+ // H_ID
+ //
+ this.H_ID.DataPropertyName = "ID";
+ this.H_ID.HeaderText = "ID";
+ this.H_ID.Name = "H_ID";
+ this.H_ID.ReadOnly = true;
+ this.H_ID.Visible = false;
+ //
+ // H_RowIndex
+ //
+ this.H_RowIndex.DataPropertyName = "RowIndex";
+ this.H_RowIndex.HeaderText = "序号";
+ this.H_RowIndex.Name = "H_RowIndex";
+ this.H_RowIndex.ReadOnly = true;
+ this.H_RowIndex.Width = 80;
+ //
+ // H_BarCode
+ //
+ this.H_BarCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.H_BarCode.DataPropertyName = "BarCode";
+ this.H_BarCode.HeaderText = "条码";
+ this.H_BarCode.Name = "H_BarCode";
+ this.H_BarCode.ReadOnly = true;
+ //
+ // 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;
+ //
// uLabel4
//
this.uLabel4.AutoSize = true;
@@ -473,65 +509,6 @@
this.flowLayoutPanel1.Size = new System.Drawing.Size(549, 519);
this.flowLayoutPanel1.TabIndex = 0;
//
- // H_ID
- //
- this.H_ID.DataPropertyName = "ID";
- this.H_ID.HeaderText = "ID";
- this.H_ID.Name = "H_ID";
- this.H_ID.ReadOnly = true;
- this.H_ID.Visible = false;
- //
- // H_RowIndex
- //
- this.H_RowIndex.DataPropertyName = "RowIndex";
- this.H_RowIndex.HeaderText = "序号";
- this.H_RowIndex.Name = "H_RowIndex";
- this.H_RowIndex.ReadOnly = true;
- this.H_RowIndex.Width = 80;
- //
- // H_BarCode
- //
- this.H_BarCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
- this.H_BarCode.DataPropertyName = "BarCode";
- this.H_BarCode.HeaderText = "条码";
- this.H_BarCode.Name = "H_BarCode";
- this.H_BarCode.ReadOnly = true;
- //
- // 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
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -586,7 +563,6 @@
private System.Windows.Forms.DataGridViewTextBoxColumn U_BarCode;
private System.Windows.Forms.DataGridViewTextBoxColumn U_Goods_Name;
private System.Windows.Forms.DataGridViewTextBoxColumn U_Weight;
- private WinFormControl.UButton noCodeBtn;
private WinFormControl.UButton noWeightBtn;
private WinFormControl.ULabel uLabel5;
private WinFormControl.UTextBoxWithPad lowWeight;
diff --git a/ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs b/ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs
index 80ab795..a811f18 100644
--- a/ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs
+++ b/ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs
@@ -89,7 +89,6 @@ namespace ButcherFactory.CarcassInStore_
XmlUtil.SerializerObjToFile(new CarcassInStoreFormConfig { Weight = errorWeight, WorkUnitID = workUnitID });
}
-
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
@@ -113,27 +112,14 @@ namespace ButcherFactory.CarcassInStore_
{
this.Invoke(new Action(() =>
{
- var last = needSubmitedList.LastOrDefault();
- if (last == null)
- {
- SoundPalyUtil.PlaySound(SoundType.Error);
- return;
- }
+ var entity = CarcassInStoreBL.Insert(workUnitID, batchID, weight);
+ needSubmitedList.Insert(0, entity);
+ needSubmitGrid.FirstDisplayedScrollingRowIndex = 0;
+ needSubmitGrid.Refresh();
+ if (errorWeight.HasValue && weight != 0 && weight < errorWeight)
+ SoundPalyUtil.PlaySound("Sounds\\wtl.wav");
else
- {
- last.Weight = weight;
- CarcassInStoreBL.Update(last.ID, "Weight", weight);
- needSubmitedList.Remove(last);
- needSubmitGrid.Refresh();
- historyList.Insert(0, last);
- if (historyList.Any())
- historyDataGrid.FirstDisplayedScrollingRowIndex = 0;
- historyDataGrid.Refresh();
- if (errorWeight.HasValue && weight != 0 && weight < errorWeight)
- SoundPalyUtil.PlaySound("Sounds\\wtl.wav");
- else
- SoundPalyUtil.PlaySound(SoundType.ShotSucc);
- }
+ SoundPalyUtil.PlaySound(SoundType.ShotSucc);
}));
}
}
@@ -170,63 +156,32 @@ namespace ButcherFactory.CarcassInStore_
var btn = new UButton() { Width = 130, Height = 75, Text = item.Goods_Name, Tag = item.Goods_ID, Font = new Font("宋体", 15), Margin = new Padding(26, 10, 26, 35), PlaySound = true };
btn.Click += (sender, e) =>
{
- if (!noCode)
- {
- if (string.IsNullOrEmpty(uScanPanel1.TextBox.Text))
- throw new Exception("请先扫码");
- if (uScanPanel1.TextBox.Text.Length != 23)
- throw new Exception("条码格式不正确");
- }
+ if (!string.IsNullOrEmpty(uScanPanel1.TextBox.Text) && uScanPanel1.TextBox.Text.Length != 23)
+ throw new Exception("条码格式不正确");
var c = sender as UButton;
- var list = CarcassInStoreBL.InsertOrUpdate(workUnitID, batchID, (long)c.Tag, uScanPanel1.TextBox.Text);
- AfterUpdateOrInsert(list);
+ GoodsBtnClick((long)c.Tag, c.Text);
uScanPanel1.TextBox.Text = string.Empty;
- if (noCode)
- {
- noCodeBtn_Click(c, EventArgs.Empty);
- noCodeBtn.AsClicked = false;
- }
};
flowLayoutPanel1.Controls.Add(btn);
}
}
static object _lock = new object();
- void AfterUpdateOrInsert(List list)
+ void GoodsBtnClick(long goodsID, string goodsName)
{
lock (_lock)
{
- bool upNeedRefresh = false;
- bool downNeedRefresh = false;
- foreach (var item in list)
- {
- if (item.Weight.HasValue)
- {
- var first = historyList.FirstOrDefault(x => x.ID == item.ID);
- if (first != null)
- {
- first.Goods_Name = item.Goods_Name;
- downNeedRefresh = true;
- }
- }
- else
- {
- var upFirst = needSubmitedList.FirstOrDefault(x => x.ID == item.ID);
- if (upFirst != null)
- upFirst.Goods_Name = item.Goods_Name;
- else
- needSubmitedList.Insert(0, item);
- upNeedRefresh = true;
- }
- }
- if (upNeedRefresh)
- {
- if (needSubmitedList.Any())
- needSubmitGrid.FirstDisplayedScrollingRowIndex = 0;
- needSubmitGrid.Refresh();
- }
- else if (downNeedRefresh)
- historyDataGrid.Refresh();
+ var last = needSubmitedList.LastOrDefault();
+ if (last == null)
+ throw new Exception("未过称");
+ CarcassInStoreBL.Update(last.ID, goodsID, uScanPanel1.TextBox.Text);
+ last.Goods_Name = goodsName;
+ last.BarCode = uScanPanel1.TextBox.Text;
+ historyList.Insert(0,last);
+ needSubmitedList.Remove(last);
+ historyDataGrid.FirstDisplayedScrollingRowIndex = 0;
+ needSubmitGrid.Refresh();
+ historyDataGrid.Refresh();
}
}
@@ -250,17 +205,36 @@ namespace ButcherFactory.CarcassInStore_
this.Invoke(new Action(() =>
{
if (netStateWatch1.NetState)
- {
- var list = CarcassInStoreBL.DoWithPadData(workUnitID, batchID);
- if (list.Any())
- AfterUpdateOrInsert(list);
- }
+ SyncFromPad();
}));
}
Thread.Sleep(2000);
}
}
+ void SyncFromPad()
+ {
+ lock (_lock)
+ {
+ if (needSubmitedList.Any())
+ {
+ CarcassInStoreBL.DoWithPadData(needSubmitedList);
+ var filled = needSubmitedList.Where(x => x.Goods_ID.HasValue).ToList();
+ foreach (var item in filled)
+ {
+ needSubmitedList.Remove(item);
+ historyList.Insert(0, item);
+ }
+ if (filled.Any())
+ {
+ needSubmitGrid.Refresh();
+ historyDataGrid.FirstDisplayedScrollingRowIndex = 0;
+ historyDataGrid.Refresh();
+ }
+ }
+ }
+ }
+
void GetBeforeWeight()
{
while (true)
@@ -310,17 +284,6 @@ namespace ButcherFactory.CarcassInStore_
Close();
}
- bool noCode;
- private void noCodeBtn_Click(object sender, EventArgs e)
- {
- if (noCode)
- noCodeBtn.Text = "无 码";
- else
- noCodeBtn.Text = "等待插入";
-
- noCode = !noCode;
- }
-
private void noWeightBtn_Click(object sender, EventArgs e)
{
ReceiveWeight(0);
diff --git a/ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.resx b/ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.resx
index 7aae463..fe5a390 100644
--- a/ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.resx
+++ b/ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.resx
@@ -124,14 +124,6 @@
wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK
goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg
KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII=
-
-
-
-
- iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
- wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK
- goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg
- KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII=
diff --git a/ButcherFactory.Form/CarcassInStore_/CarcassInStoreFormOld.cs b/ButcherFactory.Form/CarcassInStore_/CarcassInStoreFormOld.cs
new file mode 100644
index 0000000..a8907f1
--- /dev/null
+++ b/ButcherFactory.Form/CarcassInStore_/CarcassInStoreFormOld.cs
@@ -0,0 +1,329 @@
+//using ButcherFactory.BO;
+//using ButcherFactory.BO.Rpcs;
+//using ButcherFactory.BO.Utils;
+//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;
+//using ButcherFactory.Utils;
+//using ButcherFactory.BO.LocalBL;
+//using WinFormControl;
+//using System.Threading;
+
+//namespace ButcherFactory.CarcassInStore_
+//{
+// public partial class CarcassInStoreFormOld:Form, IWithRoleForm
+// {
+// #region IWithRoleForm
+
+// public List RoleName
+// {
+// get { return new List { (short)设备类别.白条入库 }; }
+// }
+
+// public Form Generate()
+// {
+// return this;
+// }
+
+// #endregion
+
+// Thread syncPadTask;
+// Thread syncBeforeWeight;
+// Thread uploadData;
+// BindingList needSubmitedList;
+// BindingList historyList;
+// long? workUnitID;
+// long? batchID;
+// decimal? errorWeight = null;
+// public CarcassInStoreForm()
+// {
+// InitializeComponent();
+// 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();
+// };
+// workUnitSelect.SelectedIndexChanged += delegate
+// {
+// if (workUnitSelect.SelectedValue == null)
+// workUnitID = null;
+// else
+// workUnitID = (long)workUnitSelect.SelectedValue;
+// SaveConfig(workUnitSelect, EventArgs.Empty);
+// };
+// productBatchSelect.SelectedIndexChanged += delegate
+// {
+// if (productBatchSelect.SelectedValue == null)
+// batchID = null;
+// else
+// batchID = (long)productBatchSelect.SelectedValue;
+// };
+// lowWeight.LostFocus += SaveConfig;
+// }
+
+// void SaveConfig(object sender, EventArgs e)
+// {
+// var txt = lowWeight.Text.Trim();
+// if (string.IsNullOrEmpty(txt))
+// errorWeight = null;
+// else
+// {
+// decimal v;
+// if (decimal.TryParse(lowWeight.Text.Trim(), out v))
+// errorWeight = v;
+// else
+// lowWeight.Text = string.Format("{0:#0.######}", errorWeight);
+// }
+
+// XmlUtil.SerializerObjToFile(new CarcassInStoreFormConfig { Weight = errorWeight, WorkUnitID = workUnitID });
+// }
+
+
+// protected override void OnLoad(EventArgs e)
+// {
+// base.OnLoad(e);
+// var initTask = new Thread(LoadBind);
+// initTask.Start();
+
+// syncPadTask = new Thread(SyncPadData);
+// syncPadTask.Start();
+
+// syncBeforeWeight = new Thread(GetBeforeWeight);
+// syncBeforeWeight.Start();
+
+// uploadData = new Thread(UpLoadLocalData);
+// uploadData.Start();
+// uWeightControl1.ReceivedValue += ReceiveWeight;
+// }
+
+// void ReceiveWeight(decimal weight)
+// {
+// lock (_lock)
+// {
+// 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);
+// if (historyList.Any())
+// historyDataGrid.FirstDisplayedScrollingRowIndex = 0;
+// historyDataGrid.Refresh();
+// if (errorWeight.HasValue && weight != 0 && weight < errorWeight)
+// SoundPalyUtil.PlaySound("Sounds\\wtl.wav");
+// else
+// SoundPalyUtil.PlaySound(SoundType.ShotSucc);
+// }
+// }));
+// }
+// }
+
+// void LoadBind()
+// {
+// this.Invoke(new Action(() =>
+// {
+// if (netStateWatch1.NetState)
+// {
+// BaseInfoSyncRpc.SyncGoodsByTag(ApplyClient.白条出入库);
+// BaseInfoSyncRpc.SyncBaseInfo();
+// BaseInfoSyncRpc.SyncBaseInfo();
+// }
+// productBatchSelect.EBindComboBox(x => x.Date == DateTime.Today);
+// var config = XmlUtil.DeserializeFromFile();
+// if (config.Weight.HasValue)
+// {
+// lowWeight.Text = config.Weight.Value.ToString("#0.######");
+// errorWeight = config.Weight;
+// }
+// workUnitSelect.EBindComboBox(x => x.ID == config.WorkUnitID);
+
+// BindGoods();
+// BindGrid();
+// }));
+// }
+
+// void BindGoods()
+// {
+// var goods = CarcassInStoreBL.GetGoodsList();
+// foreach (var item in goods)
+// {
+// var btn = new UButton() { Width = 130, Height = 75, Text = item.Goods_Name, Tag = item.Goods_ID, Font = new Font("宋体", 15), Margin = new Padding(26, 10, 26, 35), PlaySound = true };
+// btn.Click += (sender, e) =>
+// {
+// if (!noCode)
+// {
+// if (string.IsNullOrEmpty(uScanPanel1.TextBox.Text))
+// throw new Exception("请先扫码");
+// if (uScanPanel1.TextBox.Text.Length != 23)
+// throw new Exception("条码格式不正确");
+// }
+// var c = sender as UButton;
+// var list = CarcassInStoreBL.InsertOrUpdate(workUnitID, batchID, (long)c.Tag, uScanPanel1.TextBox.Text);
+// AfterUpdateOrInsert(list);
+// uScanPanel1.TextBox.Text = string.Empty;
+// if (noCode)
+// {
+// noCodeBtn_Click(c, EventArgs.Empty);
+// noCodeBtn.AsClicked = false;
+// }
+// };
+// flowLayoutPanel1.Controls.Add(btn);
+// }
+// }
+
+// static object _lock = new object();
+// void AfterUpdateOrInsert(List list)
+// {
+// lock (_lock)
+// {
+// bool upNeedRefresh = false;
+// bool downNeedRefresh = false;
+// foreach (var item in list)
+// {
+// if (item.Weight.HasValue)
+// {
+// var first = historyList.FirstOrDefault(x => x.ID == item.ID);
+// if (first != null)
+// {
+// first.Goods_Name = item.Goods_Name;
+// downNeedRefresh = true;
+// }
+// }
+// else
+// {
+// var upFirst = needSubmitedList.FirstOrDefault(x => x.ID == item.ID);
+// if (upFirst != null)
+// upFirst.Goods_Name = item.Goods_Name;
+// else
+// needSubmitedList.Insert(0, item);
+// upNeedRefresh = true;
+// }
+// }
+// if (upNeedRefresh)
+// {
+// if (needSubmitedList.Any())
+// needSubmitGrid.FirstDisplayedScrollingRowIndex = 0;
+// needSubmitGrid.Refresh();
+// }
+// else if (downNeedRefresh)
+// historyDataGrid.Refresh();
+// }
+// }
+
+// void BindGrid()
+// {
+// needSubmitedList = CarcassInStoreBL.GetLocalDataWithState(false);
+// needSubmitGrid.DataSource = needSubmitedList;
+// needSubmitGrid.Refresh();
+
+// historyList = CarcassInStoreBL.GetLocalDataWithState(true);
+// historyDataGrid.DataSource = historyList;
+// historyDataGrid.Refresh();
+// }
+
+// void SyncPadData()
+// {
+// while (true)
+// {
+// if (this.IsHandleCreated)
+// {
+// this.Invoke(new Action(() =>
+// {
+// if (netStateWatch1.NetState)
+// {
+// var list = CarcassInStoreBL.DoWithPadData(workUnitID, batchID);
+// if (list.Any())
+// AfterUpdateOrInsert(list);
+// }
+// }));
+// }
+// Thread.Sleep(2000);
+// }
+// }
+
+// void GetBeforeWeight()
+// {
+// while (true)
+// {
+// if (this.IsHandleCreated)
+// {
+// this.Invoke(new Action(() =>
+// {
+// if (netStateWatch1.NetState)
+// {
+// var list = historyList.Where(x => x.BeforeWeight == null && !string.IsNullOrEmpty(x.BarCode)).Take(5);
+// if (list.Any())
+// {
+// var back = CarcassInStoreBL.GetBeforeWeight(list.Select(x => x.BarCode));
+// if (back.Any())
+// {
+// foreach (var item in back)
+// list.First(x => x.BarCode == item.StringExt1).BeforeWeight = item.DecimalExt1;
+// historyDataGrid.Refresh();
+// }
+// }
+// }
+// }));
+// }
+// Thread.Sleep(2000);
+// }
+// }
+
+// void UpLoadLocalData()
+// {
+// while (true)
+// {
+// if (this.IsHandleCreated)
+// {
+// this.Invoke(new Action(() =>
+// {
+// if (netStateWatch1.NetState)
+// CarcassInStoreBL.UploadCarcassInfo();
+// }));
+// }
+// Thread.Sleep(2000);
+// }
+// }
+
+// private void closeBtn_Click(object sender, EventArgs e)
+// {
+// Close();
+// }
+
+// bool noCode;
+// private void noCodeBtn_Click(object sender, EventArgs e)
+// {
+// if (noCode)
+// noCodeBtn.Text = "无 码";
+// else
+// noCodeBtn.Text = "等待插入";
+
+// noCode = !noCode;
+// }
+
+// private void noWeightBtn_Click(object sender, EventArgs e)
+// {
+// ReceiveWeight(0);
+// }
+// }
+//}
diff --git a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.Designer.cs b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.Designer.cs
index 0c0f216..6b0db20 100644
--- a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.Designer.cs
+++ b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.Designer.cs
@@ -28,16 +28,19 @@
///
private void InitializeComponent()
{
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CarcassTakeOutForm));
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = 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 dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = 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 dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = 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.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CarcassTakeOutForm));
this.workUnitSelect = new System.Windows.Forms.ComboBox();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.closeBtn = new WinFormControl.UButton();
@@ -48,25 +51,29 @@
this.uLabel1 = new WinFormControl.ULabel();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.historyDataGrid = new WinFormControl.UDataGridView();
+ this.H_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.H_RowIndex = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.H_BarCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.H_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.H_BeforeWeight = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.uLabel4 = new WinFormControl.ULabel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.readBtn = new WinFormControl.UButton();
- this.deleteBtn = new WinFormControl.UButton();
this.submitBtn = new WinFormControl.UButton();
this.needSubmitGrid = new WinFormControl.UDataGridView();
- this.uLabel3 = new WinFormControl.ULabel();
this.U_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.U_RowIndex = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.U_BarCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.U_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.U_BeforeWeight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.U_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.H_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.H_RowIndex = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.H_BarCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.H_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.H_BeforeWeight = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.uLabel3 = new WinFormControl.ULabel();
+ this.weightGrid = new WinFormControl.UDataGridView();
+ this.splitContainer2 = new System.Windows.Forms.SplitContainer();
+ this.W_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.W_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.noBarCode = new WinFormControl.UButton();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -75,6 +82,11 @@
((System.ComponentModel.ISupportInitialize)(this.historyDataGrid)).BeginInit();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.needSubmitGrid)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.weightGrid)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
+ this.splitContainer2.Panel1.SuspendLayout();
+ this.splitContainer2.Panel2.SuspendLayout();
+ this.splitContainer2.SuspendLayout();
this.SuspendLayout();
//
// workUnitSelect
@@ -101,6 +113,7 @@
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.BackColor = System.Drawing.Color.Transparent;
+ this.splitContainer1.Panel1.Controls.Add(this.noBarCode);
this.splitContainer1.Panel1.Controls.Add(this.closeBtn);
this.splitContainer1.Panel1.Controls.Add(this.uTimerLabel1);
this.splitContainer1.Panel1.Controls.Add(this.workUnitSelect);
@@ -196,10 +209,10 @@
| 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, 252);
+ this.groupBox2.Location = new System.Drawing.Point(11, 284);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(5);
- this.groupBox2.Size = new System.Drawing.Size(1140, 254);
+ this.groupBox2.Size = new System.Drawing.Size(1140, 222);
this.groupBox2.TabIndex = 3;
this.groupBox2.TabStop = false;
//
@@ -237,9 +250,60 @@
this.historyDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle5;
this.historyDataGrid.RowTemplate.Height = 23;
this.historyDataGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.historyDataGrid.Size = new System.Drawing.Size(1130, 230);
+ this.historyDataGrid.Size = new System.Drawing.Size(1130, 198);
this.historyDataGrid.TabIndex = 2;
//
+ // H_ID
+ //
+ this.H_ID.DataPropertyName = "ID";
+ this.H_ID.HeaderText = "ID";
+ this.H_ID.Name = "H_ID";
+ this.H_ID.ReadOnly = true;
+ this.H_ID.Visible = false;
+ //
+ // H_RowIndex
+ //
+ this.H_RowIndex.DataPropertyName = "RowIndex";
+ this.H_RowIndex.HeaderText = "序号";
+ this.H_RowIndex.Name = "H_RowIndex";
+ this.H_RowIndex.ReadOnly = true;
+ //
+ // H_BarCode
+ //
+ this.H_BarCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.H_BarCode.DataPropertyName = "BarCode";
+ this.H_BarCode.HeaderText = "条码";
+ this.H_BarCode.Name = "H_BarCode";
+ this.H_BarCode.ReadOnly = true;
+ //
+ // 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_BeforeWeight
+ //
+ this.H_BeforeWeight.DataPropertyName = "BeforeWeight";
+ dataGridViewCellStyle3.Format = "#0.######";
+ this.H_BeforeWeight.DefaultCellStyle = dataGridViewCellStyle3;
+ this.H_BeforeWeight.HeaderText = "入库重量";
+ this.H_BeforeWeight.Name = "H_BeforeWeight";
+ this.H_BeforeWeight.ReadOnly = true;
+ this.H_BeforeWeight.Width = 150;
+ //
+ // H_Weight
+ //
+ this.H_Weight.DataPropertyName = "Weight";
+ dataGridViewCellStyle4.Format = "#0.######";
+ this.H_Weight.DefaultCellStyle = dataGridViewCellStyle4;
+ this.H_Weight.HeaderText = "重量";
+ this.H_Weight.Name = "H_Weight";
+ this.H_Weight.ReadOnly = true;
+ this.H_Weight.Width = 150;
+ //
// uLabel4
//
this.uLabel4.AutoSize = true;
@@ -255,15 +319,14 @@
//
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.splitContainer2);
this.groupBox1.Controls.Add(this.readBtn);
- this.groupBox1.Controls.Add(this.deleteBtn);
this.groupBox1.Controls.Add(this.submitBtn);
- this.groupBox1.Controls.Add(this.needSubmitGrid);
this.groupBox1.Controls.Add(this.uLabel3);
this.groupBox1.Location = new System.Drawing.Point(11, 13);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(5);
- this.groupBox1.Size = new System.Drawing.Size(1140, 226);
+ this.groupBox1.Size = new System.Drawing.Size(1140, 265);
this.groupBox1.TabIndex = 2;
this.groupBox1.TabStop = false;
//
@@ -276,10 +339,10 @@
this.readBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.readBtn.Font = new System.Drawing.Font("宋体", 15F);
this.readBtn.ForeColor = System.Drawing.Color.Black;
- this.readBtn.Location = new System.Drawing.Point(269, 20);
+ this.readBtn.Location = new System.Drawing.Point(145, 20);
this.readBtn.Name = "readBtn";
this.readBtn.PlaySound = false;
- this.readBtn.Size = new System.Drawing.Size(111, 34);
+ this.readBtn.Size = new System.Drawing.Size(114, 34);
this.readBtn.SoundType = WinFormControl.SoundType.Click;
this.readBtn.TabIndex = 13;
this.readBtn.Text = "读 入";
@@ -287,26 +350,6 @@
this.readBtn.WithStataHode = false;
this.readBtn.Click += new System.EventHandler(this.readBtn_Click);
//
- // deleteBtn
- //
- this.deleteBtn.AsClicked = false;
- this.deleteBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("deleteBtn.BackgroundImage")));
- this.deleteBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214)))));
- this.deleteBtn.FlatAppearance.BorderSize = 0;
- this.deleteBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.deleteBtn.Font = new System.Drawing.Font("宋体", 15F);
- this.deleteBtn.ForeColor = System.Drawing.Color.Black;
- this.deleteBtn.Location = new System.Drawing.Point(140, 20);
- this.deleteBtn.Name = "deleteBtn";
- this.deleteBtn.PlaySound = false;
- this.deleteBtn.Size = new System.Drawing.Size(111, 34);
- this.deleteBtn.SoundType = WinFormControl.SoundType.Click;
- this.deleteBtn.TabIndex = 12;
- this.deleteBtn.Text = "删 除";
- this.deleteBtn.UseVisualStyleBackColor = true;
- this.deleteBtn.WithStataHode = false;
- this.deleteBtn.Click += new System.EventHandler(this.deleteBtn_Click);
- //
// submitBtn
//
this.submitBtn.AsClicked = false;
@@ -333,15 +376,15 @@
this.needSubmitGrid.AllowUserToDeleteRows = false;
this.needSubmitGrid.AllowUserToResizeColumns = false;
this.needSubmitGrid.AllowUserToResizeRows = false;
- dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
- this.needSubmitGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6;
+ dataGridViewCellStyle9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
+ this.needSubmitGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9;
this.needSubmitGrid.BackgroundColor = System.Drawing.Color.White;
this.needSubmitGrid.BorderStyle = System.Windows.Forms.BorderStyle.None;
- dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 12F);
- dataGridViewCellStyle7.ForeColor = System.Drawing.Color.White;
- dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.needSubmitGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
+ dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle10.Font = new System.Drawing.Font("宋体", 12F);
+ dataGridViewCellStyle10.ForeColor = System.Drawing.Color.White;
+ dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.needSubmitGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10;
this.needSubmitGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.needSubmitGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.U_ID,
@@ -350,31 +393,20 @@
this.U_Goods_Name,
this.U_BeforeWeight,
this.U_Weight});
- this.needSubmitGrid.Dock = System.Windows.Forms.DockStyle.Bottom;
- this.needSubmitGrid.Location = new System.Drawing.Point(5, 62);
+ this.needSubmitGrid.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.needSubmitGrid.Location = new System.Drawing.Point(0, 0);
this.needSubmitGrid.MultiSelect = false;
this.needSubmitGrid.Name = "needSubmitGrid";
this.needSubmitGrid.ReadOnly = true;
this.needSubmitGrid.RowHeadersVisible = false;
- dataGridViewCellStyle9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
- this.needSubmitGrid.RowsDefaultCellStyle = dataGridViewCellStyle9;
+ dataGridViewCellStyle12.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
+ this.needSubmitGrid.RowsDefaultCellStyle = dataGridViewCellStyle12;
this.needSubmitGrid.RowTemplate.Height = 23;
this.needSubmitGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.needSubmitGrid.Size = new System.Drawing.Size(1130, 159);
+ this.needSubmitGrid.Size = new System.Drawing.Size(872, 200);
this.needSubmitGrid.TabIndex = 1;
//
- // uLabel3
- //
- this.uLabel3.AutoSize = true;
- this.uLabel3.BackColor = System.Drawing.Color.White;
- this.uLabel3.Font = new System.Drawing.Font("宋体", 13F);
- this.uLabel3.Location = new System.Drawing.Point(8, 0);
- this.uLabel3.Name = "uLabel3";
- this.uLabel3.Size = new System.Drawing.Size(80, 18);
- this.uLabel3.TabIndex = 0;
- this.uLabel3.Text = "领料明细";
- //
// U_ID
//
this.U_ID.DataPropertyName = "ID";
@@ -409,8 +441,8 @@
// U_BeforeWeight
//
this.U_BeforeWeight.DataPropertyName = "BeforeWeight";
- dataGridViewCellStyle8.Format = "#0.######";
- this.U_BeforeWeight.DefaultCellStyle = dataGridViewCellStyle8;
+ dataGridViewCellStyle11.Format = "#0.######";
+ this.U_BeforeWeight.DefaultCellStyle = dataGridViewCellStyle11;
this.U_BeforeWeight.HeaderText = "入库重量";
this.U_BeforeWeight.Name = "U_BeforeWeight";
this.U_BeforeWeight.ReadOnly = true;
@@ -424,56 +456,104 @@
this.U_Weight.ReadOnly = true;
this.U_Weight.Width = 150;
//
- // H_ID
- //
- this.H_ID.DataPropertyName = "ID";
- this.H_ID.HeaderText = "ID";
- this.H_ID.Name = "H_ID";
- this.H_ID.ReadOnly = true;
- this.H_ID.Visible = false;
- //
- // H_RowIndex
- //
- this.H_RowIndex.DataPropertyName = "RowIndex";
- this.H_RowIndex.HeaderText = "序号";
- this.H_RowIndex.Name = "H_RowIndex";
- this.H_RowIndex.ReadOnly = true;
- //
- // H_BarCode
- //
- this.H_BarCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
- this.H_BarCode.DataPropertyName = "BarCode";
- this.H_BarCode.HeaderText = "条码";
- this.H_BarCode.Name = "H_BarCode";
- this.H_BarCode.ReadOnly = true;
- //
- // 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_BeforeWeight
+ // uLabel3
//
- this.H_BeforeWeight.DataPropertyName = "BeforeWeight";
- dataGridViewCellStyle3.Format = "#0.######";
- this.H_BeforeWeight.DefaultCellStyle = dataGridViewCellStyle3;
- this.H_BeforeWeight.HeaderText = "入库重量";
- this.H_BeforeWeight.Name = "H_BeforeWeight";
- this.H_BeforeWeight.ReadOnly = true;
- this.H_BeforeWeight.Width = 150;
+ this.uLabel3.AutoSize = true;
+ this.uLabel3.BackColor = System.Drawing.Color.White;
+ this.uLabel3.Font = new System.Drawing.Font("宋体", 13F);
+ this.uLabel3.Location = new System.Drawing.Point(8, 0);
+ this.uLabel3.Name = "uLabel3";
+ this.uLabel3.Size = new System.Drawing.Size(80, 18);
+ this.uLabel3.TabIndex = 0;
+ this.uLabel3.Text = "领料明细";
//
- // H_Weight
+ // weightGrid
//
- this.H_Weight.DataPropertyName = "Weight";
- dataGridViewCellStyle4.Format = "#0.######";
- this.H_Weight.DefaultCellStyle = dataGridViewCellStyle4;
- this.H_Weight.HeaderText = "重量";
- this.H_Weight.Name = "H_Weight";
- this.H_Weight.ReadOnly = true;
- this.H_Weight.Width = 150;
+ this.weightGrid.AllowUserToAddRows = false;
+ this.weightGrid.AllowUserToDeleteRows = false;
+ this.weightGrid.AllowUserToResizeColumns = false;
+ this.weightGrid.AllowUserToResizeRows = false;
+ dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
+ this.weightGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6;
+ this.weightGrid.BackgroundColor = System.Drawing.Color.White;
+ this.weightGrid.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 12F);
+ dataGridViewCellStyle7.ForeColor = System.Drawing.Color.White;
+ dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.weightGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
+ this.weightGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.weightGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.W_ID,
+ this.W_Weight});
+ this.weightGrid.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.weightGrid.Location = new System.Drawing.Point(0, 0);
+ this.weightGrid.MultiSelect = false;
+ this.weightGrid.Name = "weightGrid";
+ this.weightGrid.ReadOnly = true;
+ this.weightGrid.RowHeadersVisible = false;
+ dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
+ this.weightGrid.RowsDefaultCellStyle = dataGridViewCellStyle8;
+ this.weightGrid.RowTemplate.Height = 23;
+ this.weightGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+ this.weightGrid.Size = new System.Drawing.Size(254, 200);
+ this.weightGrid.TabIndex = 14;
+ //
+ // splitContainer2
+ //
+ this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
+ this.splitContainer2.IsSplitterFixed = true;
+ this.splitContainer2.Location = new System.Drawing.Point(5, 60);
+ this.splitContainer2.Name = "splitContainer2";
+ //
+ // splitContainer2.Panel1
+ //
+ this.splitContainer2.Panel1.Controls.Add(this.weightGrid);
+ //
+ // splitContainer2.Panel2
+ //
+ this.splitContainer2.Panel2.Controls.Add(this.needSubmitGrid);
+ this.splitContainer2.Size = new System.Drawing.Size(1130, 200);
+ this.splitContainer2.SplitterDistance = 254;
+ this.splitContainer2.TabIndex = 14;
+ //
+ // W_ID
+ //
+ this.W_ID.DataPropertyName = "ID";
+ this.W_ID.HeaderText = "序号";
+ this.W_ID.Name = "W_ID";
+ this.W_ID.ReadOnly = true;
+ //
+ // W_Weight
+ //
+ this.W_Weight.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.W_Weight.DataPropertyName = "Weight";
+ this.W_Weight.HeaderText = "重量";
+ this.W_Weight.Name = "W_Weight";
+ this.W_Weight.ReadOnly = true;
+ //
+ // noBarCode
+ //
+ this.noBarCode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.noBarCode.AsClicked = false;
+ this.noBarCode.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("noBarCode.BackgroundImage")));
+ this.noBarCode.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214)))));
+ this.noBarCode.FlatAppearance.BorderSize = 0;
+ this.noBarCode.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.noBarCode.Font = new System.Drawing.Font("宋体", 15F);
+ this.noBarCode.ForeColor = System.Drawing.Color.Black;
+ this.noBarCode.Location = new System.Drawing.Point(450, 45);
+ this.noBarCode.Name = "noBarCode";
+ this.noBarCode.PlaySound = false;
+ this.noBarCode.Size = new System.Drawing.Size(114, 34);
+ this.noBarCode.SoundType = WinFormControl.SoundType.Click;
+ this.noBarCode.TabIndex = 14;
+ this.noBarCode.Text = "无 码";
+ this.noBarCode.UseVisualStyleBackColor = true;
+ this.noBarCode.WithStataHode = false;
+ this.noBarCode.Click += new System.EventHandler(this.noBarCode_Click);
//
// CarcassTakeOutForm
//
@@ -496,6 +576,11 @@
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.needSubmitGrid)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.weightGrid)).EndInit();
+ this.splitContainer2.Panel1.ResumeLayout(false);
+ this.splitContainer2.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
+ this.splitContainer2.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -517,7 +602,6 @@
private WinFormControl.ULabel uLabel3;
private WinFormControl.UButton closeBtn;
private WinFormControl.UButton readBtn;
- private WinFormControl.UButton deleteBtn;
private WinFormControl.UButton submitBtn;
private System.Windows.Forms.DataGridViewTextBoxColumn H_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn H_RowIndex;
@@ -531,6 +615,11 @@
private System.Windows.Forms.DataGridViewTextBoxColumn U_Goods_Name;
private System.Windows.Forms.DataGridViewTextBoxColumn U_BeforeWeight;
private System.Windows.Forms.DataGridViewTextBoxColumn U_Weight;
+ private WinFormControl.UDataGridView weightGrid;
+ private System.Windows.Forms.SplitContainer splitContainer2;
+ private System.Windows.Forms.DataGridViewTextBoxColumn W_ID;
+ private System.Windows.Forms.DataGridViewTextBoxColumn W_Weight;
+ private WinFormControl.UButton noBarCode;
}
}
\ No newline at end of file
diff --git a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.cs b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.cs
index 79692fb..8edb82a 100644
--- a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.cs
+++ b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.cs
@@ -34,6 +34,7 @@ namespace ButcherFactory.CarcassTakeOut_
Thread uploadData;
BindingList needSubmitedList;
BindingList historyList;
+ BindingList weightList;
long? workUnitID;
public CarcassTakeOutForm()
{
@@ -45,8 +46,8 @@ namespace ButcherFactory.CarcassTakeOut_
if (workUnitSelect.SelectedValue == null)
workUnitID = null;
else
- workUnitID = (long)workUnitSelect.SelectedValue;
- XmlUtil.SerializerObjToFile(new CarcassTakeOutFormConfig { WorkUnitID = workUnitID });
+ workUnitID = (long)workUnitSelect.SelectedValue;
+ XmlUtil.SerializerObjToFile(new CarcassTakeOutFormConfig { WorkUnitID = workUnitID });
};
this.FormClosing += delegate
{
@@ -59,7 +60,7 @@ namespace ButcherFactory.CarcassTakeOut_
protected override void OnLoad(EventArgs e)
{
- base.OnLoad(e);
+ base.OnLoad(e);
var initTask = new Thread(LoadBind);
initTask.Start();
@@ -89,6 +90,10 @@ namespace ButcherFactory.CarcassTakeOut_
void BindGrid()
{
+ weightList = CarcassTakeOutBL.GetWeightList();
+ weightGrid.DataSource = weightList;
+ weightGrid.Refresh();
+
needSubmitedList = CarcassTakeOutBL.GetLocalDataWithState(false);
needSubmitGrid.DataSource = needSubmitedList;
needSubmitGrid.Refresh();
@@ -109,10 +114,10 @@ namespace ButcherFactory.CarcassTakeOut_
if (netStateWatch1.NetState)
{
bool ff = true;
- var list = needSubmitedList.Where(x => x.BeforeWeight == null).Take(5);
+ var list = needSubmitedList.Where(x => x.BeforeWeight == null&&!string.IsNullOrEmpty(x.BarCode)).Take(5);
if (!list.Any())
{
- list = historyList.Where(x => x.BeforeWeight == null).Take(5);
+ list = historyList.Where(x => x.BeforeWeight == null && !string.IsNullOrEmpty(x.BarCode)).Take(5);
ff = false;
}
if (list.Any())
@@ -157,16 +162,21 @@ namespace ButcherFactory.CarcassTakeOut_
void uScanPanel1_AfterScan()
{
- var bar = uScanPanel1.TextBox.Text.Trim();
- if (string.IsNullOrEmpty(bar))
+ var barCode = uScanPanel1.TextBox.Text.Trim();
+ if (string.IsNullOrEmpty(barCode))
throw new Exception("请先扫码");
- if (bar.Length != 23)
+ if (barCode.Length != 23)
throw new Exception("条码格式不正确");
+ FillCode(barCode);
+ }
+
+ void FillCode(string barCode)
+ {
bool isNew;
- var entity = CarcassTakeOutBL.InsertOrUpdate(workUnitID, bar,out isNew);
+ var entity = CarcassTakeOutBL.InsertOrUpdate(workUnitID, barCode, out isNew);
if (isNew)
{
- needSubmitedList.Add(entity);
+ needSubmitedList.Insert(0, entity);
needSubmitGrid.Refresh();
}
}
@@ -178,45 +188,39 @@ namespace ButcherFactory.CarcassTakeOut_
private void submitBtn_Click(object sender, EventArgs e)
{
- var arrs = needSubmitedList.Where(x => x.Weight.HasValue).ToList();
- CarcassTakeOutBL.Submit(arrs.Select(x => x.ID));
- foreach (var item in arrs)
+ if (weightList.Count == 0)
+ throw new Exception("没有称重记录");
+ if (needSubmitedList.Count == 0)
+ throw new Exception("没有扫码记录");
+ var weight = weightList.Sum(x => x.Weight);
+ var arr = needSubmitedList.ToList();
+ CarcassTakeOutBL.Submit(weight, arr);
+ arr.Reverse();
+ foreach (var item in arr)
{
- historyList.Add(item);
+ historyList.Insert(0, item);
needSubmitedList.Remove(item);
}
+ weightList.Clear();
+ historyDataGrid.FirstDisplayedScrollingRowIndex = 0;
historyDataGrid.Refresh();
needSubmitGrid.Refresh();
- }
-
- private void deleteBtn_Click(object sender, EventArgs e)
- {
- var tag = needSubmitGrid.SelectedRows.Cast().FirstOrDefault();
- if (tag!=null)
- {
- CarcassTakeOutBL.Delete(tag.ID);
- needSubmitedList.Remove(tag);
- needSubmitGrid.Refresh();
- }
+ weightGrid.Refresh();
}
private void readBtn_Click(object sender, EventArgs e)
{
if (uWeightControl1.Weight == 0)
throw new Exception("重量为0,不能读入");
- var tags = needSubmitedList.Where(x => x.Weight == null);
- if(!tags.Any())
- return;
- CarcassTakeOutBL.SetWeight(tags.Select(x => x.ID), uWeightControl1.Weight);
- var id = tags.Max(x=>x.ID);
- foreach (var item in tags)
- {
- if (item.ID == id)
- item.Weight = uWeightControl1.Weight;
- else
- item.Weight = 0;
- }
- needSubmitGrid.Refresh();
+ var entity = CarcassTakeOutBL.InsertWeight(uWeightControl1.Weight);
+ weightList.Insert(0, entity);
+ weightGrid.FirstDisplayedScrollingRowIndex = 0;
+ weightGrid.Refresh();
+ }
+
+ private void noBarCode_Click(object sender, EventArgs e)
+ {
+ FillCode(string.Empty);
}
}
}
diff --git a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.resx b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.resx
index 0127c58..fd4a836 100644
--- a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.resx
+++ b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.resx
@@ -118,7 +118,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK
@@ -126,10 +126,7 @@
KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII=
-
- True
-
-
+
iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK
@@ -137,7 +134,22 @@
KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII=
-
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK
@@ -153,10 +165,4 @@
KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII=
-
- True
-
-
- True
-
\ No newline at end of file