From a790bb4cbf6bc7f49c247d5124bf7518b5835c64 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Wed, 1 Aug 2018 15:35:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E7=B3=BB=E5=88=97=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs | 4 + .../Bill/CarcassSaleOut_Delete.cs | 16 + .../Bill/CarcassSaleOut_Detail.cs | 5 +- ButcherFactory.BO/Bill/SegmentInStore.cs | 1 + ButcherFactory.BO/Bill/SegmentProduction.cs | 26 + .../Bill/SegmentSaleOut_Detail.cs | 5 +- ButcherFactory.BO/ButcherFactory.BO.csproj | 1 + ButcherFactory.BO/LocalBL/CarcassSaleOutBL.cs | 46 +- .../LocalBL/FormClientGoodsSetBL.cs | 2 + ButcherFactory.BO/LocalBL/SegmentInStoreBL.cs | 128 ++--- .../LocalBL/SegmentProductionBL.cs | 63 ++- ButcherFactory.BO/LocalBL/SegmentSaleOutBL.cs | 10 +- ButcherFactory.BO/LocalBL/SegmentStockUpBL.cs | 2 +- ButcherFactory.BO/Utils/AppContext.cs | 11 +- ButcherFactory.BO/Utils/ButcherFactoryUtil.cs | 12 +- ButcherFactory.BO/Utils/LoginUtil.cs | 8 +- .../ButcherFactory.Form.csproj | 9 + .../CarcassSaleOut2_/CarcassSaleOutForm.cs | 9 +- .../Dialogs/WeightDeleteRecord.Designer.cs | 267 ++++++++++ .../Dialogs/WeightDeleteRecord.cs | 37 ++ .../Dialogs/WeightDeleteRecord.resx | 159 ++++++ .../Dialogs/WeightRecordDialog.Designer.cs | 214 ++++---- .../Dialogs/WeightRecordDialog.cs | 7 + .../SegmentProductionAutoForm.cs | 40 ++ .../SegmentSaleOut_/SegmentSaleOutForm.cs | 4 +- ButcherFactory.Login/Login.xaml.cs | 2 +- ButcherFactory.Tools/MainWindow.xaml | 22 +- ButcherFactory.Tools/MainWindow.xaml.cs | 42 +- .../ButcherFactorySolution.vdproj | 463 ++++++++++-------- SelfHelpClient/DialogForm.Designer.cs | 14 +- SelfHelpClient/ItemSelect.Designer.cs | 120 +++-- SelfHelpClient/ItemSelect.cs | 21 +- SelfHelpClient/ItemSelect.resx | 35 ++ SelfHelpClient/ItemSelect2.Designer.cs | 174 +++++++ SelfHelpClient/ItemSelect2.cs | 45 ++ SelfHelpClient/ItemSelect2.resx | 168 +++++++ SelfHelpClient/MainForm.Designer.cs | 160 +++--- SelfHelpClient/Properties/Resources.resx | 4 +- SelfHelpClient/ReadCardForm.Designer.cs | 126 ++--- SelfHelpClient/ReadCardForm.cs | 6 +- SelfHelpClient/ReadCardForm.resx | 35 ++ SelfHelpClient/ReadCardForm2.Designer.cs | 149 ++++++ SelfHelpClient/ReadCardForm2.cs | 58 +++ SelfHelpClient/ReadCardForm2.resx | 155 ++++++ SelfHelpClient/Resources/bgPanel.png | Bin 0 -> 1594 bytes SelfHelpClient/Resources/fanhui.png | Bin 0 -> 2303 bytes SelfHelpClient/Resources/queren.png | Bin 0 -> 2299 bytes SelfHelpClient/SelfHelpClient.csproj | 49 +- SelfHelpClient/Template.Designer.cs | 108 ++++ SelfHelpClient/Template.cs | 20 + SelfHelpClient/Template.resx | 120 +++++ SelfHelpClient/WeightForm.Designer.cs | 279 +++++------ SelfHelpClient/WeightForm.cs | 35 +- SelfHelpClient/WeightForm.resx | 34 -- SelfHelpClient/image/bgPanel.png | Bin 0 -> 4568 bytes 55 files changed, 2690 insertions(+), 840 deletions(-) create mode 100644 ButcherFactory.BO/Bill/CarcassSaleOut_Delete.cs create mode 100644 ButcherFactory.Form/Dialogs/WeightDeleteRecord.Designer.cs create mode 100644 ButcherFactory.Form/Dialogs/WeightDeleteRecord.cs create mode 100644 ButcherFactory.Form/Dialogs/WeightDeleteRecord.resx create mode 100644 SelfHelpClient/ItemSelect2.Designer.cs create mode 100644 SelfHelpClient/ItemSelect2.cs create mode 100644 SelfHelpClient/ItemSelect2.resx create mode 100644 SelfHelpClient/ReadCardForm2.Designer.cs create mode 100644 SelfHelpClient/ReadCardForm2.cs create mode 100644 SelfHelpClient/ReadCardForm2.resx create mode 100644 SelfHelpClient/Resources/bgPanel.png create mode 100644 SelfHelpClient/Resources/fanhui.png create mode 100644 SelfHelpClient/Resources/queren.png create mode 100644 SelfHelpClient/Template.Designer.cs create mode 100644 SelfHelpClient/Template.cs create mode 100644 SelfHelpClient/Template.resx create mode 100644 SelfHelpClient/image/bgPanel.png diff --git a/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs b/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs index 0493d4f..989311a 100644 --- a/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs +++ b/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs @@ -39,6 +39,10 @@ namespace ButcherFactory.BO [Join("Goods_ID", "ID")] public string Goods_Spec { get; set; } + [ReferenceTo(typeof(Goods), "Code")] + [Join("Goods_ID", "ID")] + public string Goods_Code { get; set; } + public decimal? StandardWeight { get; set; } public decimal? StandardWeightUp { get; set; } diff --git a/ButcherFactory.BO/Bill/CarcassSaleOut_Delete.cs b/ButcherFactory.BO/Bill/CarcassSaleOut_Delete.cs new file mode 100644 index 0000000..edab923 --- /dev/null +++ b/ButcherFactory.BO/Bill/CarcassSaleOut_Delete.cs @@ -0,0 +1,16 @@ +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_CarcassSaleOut_Delete")] + public class CarcassSaleOut_Delete : CarcassSaleOut_Detail + { + public DateTime DeleteTime { get; set; } + public string Deleter { get; set; } + } +} diff --git a/ButcherFactory.BO/Bill/CarcassSaleOut_Detail.cs b/ButcherFactory.BO/Bill/CarcassSaleOut_Detail.cs index 85d2bc5..ee2169a 100644 --- a/ButcherFactory.BO/Bill/CarcassSaleOut_Detail.cs +++ b/ButcherFactory.BO/Bill/CarcassSaleOut_Detail.cs @@ -1,4 +1,5 @@ -using Forks.EnterpriseServices.DomainObjects2; +using Forks.EnterpriseServices.DataDictionary; +using Forks.EnterpriseServices.DomainObjects2; using System; using System.Collections.Generic; using System.Linq; @@ -9,6 +10,8 @@ namespace ButcherFactory.BO { [MapToTable("Butcher_CarcassSaleOut_Detail")] [KeyField("ID", KeyGenType.identity)] + [DBIndex("IDX_Butcher_CarcassSaleOut_Detail_Clustered", "BarCode", false, 0)] + [DBIndexType("IDX_Butcher_CarcassSaleOut_Detail_Clustered", IndexType.Clustered)] public class CarcassSaleOut_Detail { public CarcassSaleOut_Detail() diff --git a/ButcherFactory.BO/Bill/SegmentInStore.cs b/ButcherFactory.BO/Bill/SegmentInStore.cs index 4a07262..954f40f 100644 --- a/ButcherFactory.BO/Bill/SegmentInStore.cs +++ b/ButcherFactory.BO/Bill/SegmentInStore.cs @@ -47,6 +47,7 @@ namespace ButcherFactory.BO public DateTime? BackStoreTime { get; set; } + //-1 删除 //0 已入库 //1 正在退库 //2 已退库 diff --git a/ButcherFactory.BO/Bill/SegmentProduction.cs b/ButcherFactory.BO/Bill/SegmentProduction.cs index 5a27bce..0b057d6 100644 --- a/ButcherFactory.BO/Bill/SegmentProduction.cs +++ b/ButcherFactory.BO/Bill/SegmentProduction.cs @@ -44,6 +44,10 @@ namespace ButcherFactory.BO [Join("Goods_ID", "ID")] public string Goods_Spec { get; set; } + [ReferenceTo(typeof(Goods), "Code")] + [Join("Goods_ID", "ID")] + public string Goods_Code { get; set; } + public long? GroupID { get; set; } public bool Submited { get; set; } @@ -52,5 +56,27 @@ namespace ButcherFactory.BO //public bool TrunOut { get; set; } public long? TrunOutID { get; set; } + + [DbColumn(DefaultValue = false)] + public bool InStored { get; set; } + } + + public class ProductTask + { + public string Item { get; set; } + + public decimal? Need { get; set; } + + public decimal? Done { get; set; } + + public decimal? Last + { + get + { + if (Need.HasValue && Done.HasValue) + return Need.Value - Done.Value; + return null; + } + } } } diff --git a/ButcherFactory.BO/Bill/SegmentSaleOut_Detail.cs b/ButcherFactory.BO/Bill/SegmentSaleOut_Detail.cs index dd5e005..bafb37d 100644 --- a/ButcherFactory.BO/Bill/SegmentSaleOut_Detail.cs +++ b/ButcherFactory.BO/Bill/SegmentSaleOut_Detail.cs @@ -1,4 +1,5 @@ -using Forks.EnterpriseServices.DomainObjects2; +using Forks.EnterpriseServices.DataDictionary; +using Forks.EnterpriseServices.DomainObjects2; using System; using System.Collections.Generic; using System.Linq; @@ -9,6 +10,8 @@ namespace ButcherFactory.BO { [MapToTable("Butcher_SegmentSaleOut_Detail")] [KeyField("ID", KeyGenType.identity)] + [DBIndex("IDX_Butcher_SegmentSaleOut_Detail_Clustered", "BarCode", false, 0)] + [DBIndexType("IDX_Butcher_SegmentSaleOut_Detail_Clustered", IndexType.Clustered)] public class SegmentSaleOut_Detail { public SegmentSaleOut_Detail() diff --git a/ButcherFactory.BO/ButcherFactory.BO.csproj b/ButcherFactory.BO/ButcherFactory.BO.csproj index 431d226..947ee11 100644 --- a/ButcherFactory.BO/ButcherFactory.BO.csproj +++ b/ButcherFactory.BO/ButcherFactory.BO.csproj @@ -62,6 +62,7 @@ + diff --git a/ButcherFactory.BO/LocalBL/CarcassSaleOutBL.cs b/ButcherFactory.BO/LocalBL/CarcassSaleOutBL.cs index 9863b4a..40b9eb1 100644 --- a/ButcherFactory.BO/LocalBL/CarcassSaleOutBL.cs +++ b/ButcherFactory.BO/LocalBL/CarcassSaleOutBL.cs @@ -57,6 +57,14 @@ namespace ButcherFactory.BO.LocalBL } } + public static bool BarCodeUsed(string barCode) + { + var query = new DQueryDom(new JoinAlias(typeof(CarcassSaleOut_Detail))); + query.Where.Conditions.Add(DQCondition.EQ("BarCode", barCode)); + query.Columns.Add(DQSelectColumn.Create(DQExpression.Value(1), "c")); + return query.EExecuteScalar() != null; + } + public static BindingList GetUnSubmitWeightRecord() { var query = new DmoQuery(typeof(CarcassSaleOut_Detail)); @@ -96,7 +104,7 @@ namespace ButcherFactory.BO.LocalBL } else { - var json = ButcherFactoryUtil.SimpleMESCall(MESPath + "CarcassSaleOutStoreRpc/GetCarcassInstoreInfo", barCode); + var json = ButcherFactoryUtil.SecondUrlCall(MESPath + "CarcassSaleOutStoreRpc/GetCarcassInstoreInfo", barCode); var mesInfo = JsonConvert.DeserializeObject(json); if (!string.IsNullOrEmpty(mesInfo.Goods_Code)) { @@ -170,7 +178,7 @@ namespace ButcherFactory.BO.LocalBL public static List GetBatchFromEMS() { - var json = ButcherFactoryUtil.SimpleMESCall(MESPath + "SyncBaseInfoRpc/GetProductBatch", 9); + var json = ButcherFactoryUtil.SecondUrlCall(MESPath + "SyncBaseInfoRpc/GetProductBatch", 9); return JsonConvert.DeserializeObject>(json); } @@ -237,9 +245,28 @@ namespace ButcherFactory.BO.LocalBL { var json = JsonConvert.SerializeObject(new List() { new ExtensionObj { LongExt1 = tag.DetailID, LongExt2 = tag.WeightRecord_ID, LongExt3 = tag.ScanRecord_ID } }); RpcFacade.Call(RpcPath + "SaleOutStoreRpc/DeleteAndUpdate", json); + SaveDeleteInfo(tag); Delete(tag.ID); } + static void SaveDeleteInfo(CarcassSaleOut_Detail tag) + { + using (var session = DmoSession.New()) + { + var delete = new CarcassSaleOut_Delete(); + var type = typeof(CarcassSaleOut_Delete); + foreach (var p in tag.GetType().GetProperties()) + { + if (p.CanWrite) + type.GetProperty(p.Name).SetValue(delete, p.GetValue(tag)); + } + delete.DeleteTime = DateTime.Now; + delete.Deleter = AppContext.Worker.Name; + session.Insert(delete); + session.Commit(); + } + } + public static void RollBackDetails(List backList) { var list = backList.Select(x => new ExtensionObj { LongExt1 = x.DetailID, LongExt2 = x.WeightRecord_ID, LongExt3 = x.ScanRecord_ID }); @@ -258,6 +285,21 @@ namespace ButcherFactory.BO.LocalBL { return RpcFacade.Call(RpcPath + "SaleOutStoreRpc/HasNoAssignDetail", billid); } + + public static BindingList GetDeletedWeightRecord(long detailID) + { + var query = new DmoQuery(typeof(CarcassSaleOut_Delete)); + query.Where.Conditions.Add(DQCondition.EQ("DetailID", detailID)); + query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true)); + var list = query.EExecuteList().Cast().ToList(); + var idx = list.Count; + foreach (var item in list) + { + item.Idx = idx; + idx--; + } + return new BindingList(list); + } } class SaleOutCarcassObj diff --git a/ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs b/ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs index b2450d5..a91cbcc 100644 --- a/ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs +++ b/ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs @@ -66,6 +66,7 @@ namespace ButcherFactory.BO.LocalBL query.Columns.Add(DQSelectColumn.Field("StandardWeightUp", detail)); query.Columns.Add(DQSelectColumn.Field("StandardWeightLow", detail)); query.Columns.Add(DQSelectColumn.Field("Goods_Spec", detail)); + query.Columns.Add(DQSelectColumn.Field("Goods_Code", detail)); query.OrderBy.Expressions.Add(DQOrderByExpression.Create(main, "ID")); query.OrderBy.Expressions.Add(DQOrderByExpression.Create(detail, "ID")); @@ -85,6 +86,7 @@ namespace ButcherFactory.BO.LocalBL entity.StandardWeightUp = (decimal?)reader[4]; entity.StandardWeightLow = (decimal?)reader[5]; entity.Goods_Spec = (string)reader[6]; + entity.Goods_Code = (string)reader[7]; if (result.ContainsKey(key)) result[key].Add(entity); else diff --git a/ButcherFactory.BO/LocalBL/SegmentInStoreBL.cs b/ButcherFactory.BO/LocalBL/SegmentInStoreBL.cs index 45f1438..7a0e2c0 100644 --- a/ButcherFactory.BO/LocalBL/SegmentInStoreBL.cs +++ b/ButcherFactory.BO/LocalBL/SegmentInStoreBL.cs @@ -35,8 +35,7 @@ namespace ButcherFactory.BO.LocalBL query.Columns.Add(DQSelectColumn.Field("ProductTime")); query.Where.Conditions.Add(DQCondition.EQ("State", state)); if (state == 0) - query.Where.Conditions.Add(DQCondition.EQ(DQExpression.Snippet("CAST([_main].[InStoreTime] AS DATE)"), DQExpression.Value(DateTime.Today))); - query.Where.Conditions.Add(DQCondition.EQ("Delete", false)); + query.Where.Conditions.Add(DQCondition.Between("InStoreTime", DateTime.Today, DateTime.Today + new TimeSpan(23, 59, 59))); query.OrderBy.Expressions.Add(DQOrderByExpression.Create("RowIndex", true)); var list = new List(); using (var session = DmoSession.New()) @@ -103,7 +102,7 @@ namespace ButcherFactory.BO.LocalBL { var query = new DQueryDom(new JoinAlias(typeof(SegmentInStore))); query.Columns.Add(DQSelectColumn.Field("BarCode")); - query.Where.Conditions.Add(DQCondition.And(DQCondition.InList(DQExpression.Field("BarCode"), barCodes.Select(x => DQExpression.Value(x)).ToArray()), DQCondition.EQ("Delete", false))); + query.Where.Conditions.Add(DQCondition.And(DQCondition.InList(DQExpression.Field("BarCode"), barCodes.Select(x => DQExpression.Value(x)).ToArray()), DQCondition.InEQ("State", -1))); using (var session = DmoSession.New()) { return query.EExecuteList(session); @@ -132,6 +131,7 @@ namespace ButcherFactory.BO.LocalBL entity.Goods_Spec = obj.Goods_Spec; entity.ProductTime = obj.ProductTime; entity.Weight = obj.Weight; + session.Insert(entity); } catch { @@ -142,14 +142,16 @@ namespace ButcherFactory.BO.LocalBL } else { - if (localData.Item3) //if delete LoadFromLocal + if (localData.Item2 == -1) //if delete LoadFromLocal { - var obj = LoadLocalData(session, localData.Item1); - entity.Goods_Code = obj.Goods_Code; - entity.Goods_Name = obj.Goods_Name; - entity.Goods_Spec = obj.Goods_Spec; - entity.ProductTime = obj.ProductTime; - entity.Weight = obj.Weight; + entity.ID = localData.Item1; + entity.State = 0; + Update(session, entity.ID, + new Tuple("Store_ID", entity.Store_ID), + new Tuple("InStoreTime", entity.InStoreTime), + new Tuple("RowIndex", rowIndex), + new Tuple("State", 0) + ); } else { @@ -169,47 +171,20 @@ namespace ButcherFactory.BO.LocalBL throw new Exception(string.Format("入库失败!当前条码{0}", msg)); } } - - session.Insert(entity); session.Commit(); return entity; } } - static Tuple GetLocalData(IDmoSession session, string barCode) + static Tuple GetLocalData(IDmoSession session, string barCode) { var query = new DQueryDom(new JoinAlias(typeof(SegmentInStore))); query.Columns.Add(DQSelectColumn.Field("ID")); query.Columns.Add(DQSelectColumn.Field("State")); - query.Columns.Add(DQSelectColumn.Field("Delete")); query.Where.Conditions.Add(DQCondition.EQ("BarCode", barCode)); query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true)); query.Range = SelectRange.Top(1); - return query.EExecuteScalar(session); - } - - static SegmentProductObj LoadLocalData(IDmoSession session, long id) - { - var query = new DQueryDom(new JoinAlias(typeof(SegmentInStore))); - query.Columns.Add(DQSelectColumn.Field("Goods_Code")); - query.Columns.Add(DQSelectColumn.Field("Goods_Name")); - query.Columns.Add(DQSelectColumn.Field("Goods_Spec")); - query.Columns.Add(DQSelectColumn.Field("ProductTime")); - query.Columns.Add(DQSelectColumn.Field("Weight")); - query.Where.Conditions.Add(DQCondition.EQ("ID", id)); - using (var reader = session.ExecuteReader(query)) - { - var obj = new SegmentProductObj(); - if (reader.Read()) - { - obj.Goods_Code = (string)reader[0]; - obj.Goods_Name = (string)reader[1]; - obj.Goods_Spec = (string)reader[2]; - obj.ProductTime = (DateTime?)reader[3]; - obj.Weight = (decimal?)reader[4]; - } - return obj; - } + return query.EExecuteScalar(session); } public static void SetAsBacking(string barCode, int rowIndex) @@ -219,61 +194,68 @@ namespace ButcherFactory.BO.LocalBL var localData = GetLocalData(session, barCode); if (localData == null) throw new Exception("未入库,无法退库"); - if (localData.Item3) - throw new Exception("已删除,无法退库"); switch (localData.Item2) { + case -1: + throw new Exception("已删除,无法退库"); case 1: throw new Exception("已在退库中,等待提交"); case 2: throw new Exception("已退库,无法重复退库"); default: - UpdateAsBacking(session, localData.Item1, rowIndex); + Update(session, localData.Item1, + new Tuple("State", 1), + new Tuple("RowIndex", rowIndex)); session.Commit(); break; } } } - static void UpdateAsBacking(IDmoSession session, long id, int rowIndex) + public static void Delete(long id) { - var update = new DQUpdateDom(typeof(SegmentInStore)); - update.Columns.Add(new DQUpdateColumn("State", 1)); - update.Columns.Add(new DQUpdateColumn("RowIndex", rowIndex)); - update.Columns.Add(new DQUpdateColumn("Sync", false)); - update.Columns.Add(new DQUpdateColumn("RowVersion", DQExpression.Add(DQExpression.Field("RowVersion"), DQExpression.Value(1)))); - update.Where.Conditions.Add(DQCondition.EQ("ID", id)); - session.ExecuteNonQuery(update); + using (var session = DmoSession.New()) + { + Update(session, id, new Tuple("State", -1), + new Tuple("InStoreTime", DQExpression.NULL), + new Tuple("Store_ID", DQExpression.NULL)); + session.Commit(); + } } - public static void Delete(long id) + public static void SubmitBackStore(IEnumerable ids) { - var update = new DQUpdateDom(typeof(SegmentInStore)); - update.Columns.Add(new DQUpdateColumn("State", 0)); - update.Columns.Add(new DQUpdateColumn("Delete", 1)); - update.Columns.Add(new DQUpdateColumn("Sync", false)); - update.Columns.Add(new DQUpdateColumn("RowVersion", DQExpression.Add(DQExpression.Field("RowVersion"), DQExpression.Value(1)))); - update.Where.Conditions.Add(DQCondition.EQ("ID", id)); using (var session = DmoSession.New()) { - session.ExecuteNonQuery(update); + BatchUpdate(session, ids, new Tuple("State", 2), new Tuple("BackStoreTime", DateTime.Now)); session.Commit(); } } - public static void SubmitBackStore(IEnumerable ids) + static void Update(IDmoSession session, long id, params Tuple[] tuple) { var update = new DQUpdateDom(typeof(SegmentInStore)); - update.Columns.Add(new DQUpdateColumn("State", 2)); - update.Columns.Add(new DQUpdateColumn("BackStoreTime", DateTime.Now)); + update.Where.Conditions.Add(DQCondition.EQ("ID", id)); + + foreach (var item in tuple) + 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); + } + + static void BatchUpdate(IDmoSession session, IEnumerable ids, params Tuple[] tuple) + { + var update = new DQUpdateDom(typeof(SegmentInStore)); update.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ID"), ids.Select(x => DQExpression.Value(x)).ToArray())); - using (var session = DmoSession.New()) - { - session.ExecuteNonQuery(update); - session.Commit(); - } + + foreach (var item in tuple) + 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 InsertScanException(SegmentCodeError error) @@ -297,8 +279,8 @@ namespace ButcherFactory.BO.LocalBL query.GroupBy.Expressions.Add(DQExpression.Field("Goods_Name")); query.GroupBy.Expressions.Add(DQExpression.Field("Goods_Spec")); - query.Where.Conditions.Add(DQCondition.EQ(DQExpression.Snippet("CAST([_main].[InStoreTime] AS DATE)"), DQExpression.Value(DateTime.Today))); - query.Where.Conditions.Add(DQCondition.And(DQCondition.InEQ("State", 2), DQCondition.EQ("Delete", false))); + query.Where.Conditions.Add(DQCondition.Between("InStoreTime", DateTime.Today, DateTime.Today + new TimeSpan(23, 59, 59))); + query.Where.Conditions.Add(DQCondition.Or(DQCondition.EQ("State", 0), DQCondition.EQ("State", 1))); query.OrderBy.Expressions.Add(DQOrderByExpression.Create("Goods_Code")); var list = new BindingList(); @@ -357,8 +339,6 @@ namespace ButcherFactory.BO.LocalBL query.Columns.Add(DQSelectColumn.Field("BarCode")); query.Columns.Add(DQSelectColumn.Field("InStoreTime")); query.Columns.Add(DQSelectColumn.Field("Store_ID")); - query.Columns.Add(DQSelectColumn.Field("State")); - query.Columns.Add(DQSelectColumn.Field("Delete")); query.Columns.Add(DQSelectColumn.Field("BackStoreTime")); query.Where.Conditions.Add(DQCondition.And(DQCondition.InEQ("State", 1), DQCondition.EQ("Sync", false))); query.Range = SelectRange.Top(10); @@ -375,9 +355,7 @@ namespace ButcherFactory.BO.LocalBL obj.BarCode = (string)reader[2]; obj.InStoreTime = (DateTime)reader[3]; obj.Store_ID = (long?)reader[4]; - obj.State = (int)reader[5]; - obj.Delete = (bool)reader[6]; - obj.BackStoreTime = (DateTime?)reader[7]; + obj.BackStoreTime = (DateTime?)reader[5]; upload.Add(obj); } } @@ -407,10 +385,6 @@ namespace ButcherFactory.BO.LocalBL public long? Store_ID { get; set; } - public int State { get; set; } - - public bool Delete { get; set; } - public DateTime? BackStoreTime { get; set; } } diff --git a/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs b/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs index 32ce957..cca45ab 100644 --- a/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs +++ b/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs @@ -16,6 +16,7 @@ namespace ButcherFactory.BO.LocalBL public static class SegmentProductionBL { const string RpcPath = @"/MainSystem/B3ClientService/Rpcs/SegmentProductionRpc/"; + const string ProductTaskRpc = @"/MainSystem/B3ButcherManage/Rpcs/ProductTaskRpc/GetProductTaskNumber"; public static BindingList GetListByState(bool submited) { @@ -28,10 +29,10 @@ namespace ButcherFactory.BO.LocalBL query.Columns.Add(DQSelectColumn.Field("GroupID")); query.Columns.Add(DQSelectColumn.Field("TrunOutID")); query.Columns.Add(DQSelectColumn.Field("Goods_Spec")); - query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Delete", false), DQCondition.EQ("Submited", submited))); + query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("InStored", false), DQCondition.EQ("Delete", false), DQCondition.EQ("Submited", submited))); query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true)); if (submited) - query.Range = SelectRange.Top(20); + query.Range = SelectRange.Top(50); var list = new BindingList(); using (var session = DmoSession.New()) { @@ -95,10 +96,10 @@ namespace ButcherFactory.BO.LocalBL } } - static void FillGroupIDAsID(IDmoSession session,long id) + static void FillGroupIDAsID(IDmoSession session, long id) { var update = new DQUpdateDom(typeof(SegmentProduction)); - update.Where.Conditions.Add(DQCondition.EQ("ID",id)); + update.Where.Conditions.Add(DQCondition.EQ("ID", id)); update.Columns.Add(new DQUpdateColumn("GroupID", id)); session.ExecuteNonQuery(update); } @@ -158,6 +159,54 @@ namespace ButcherFactory.BO.LocalBL delete.EExecute(); } + public static List GetInStoreState(List codeArr) + { + var json = RpcFacade.Call(RpcPath + "CheckInStored", JsonConvert.SerializeObject(codeArr)); + return JsonConvert.DeserializeObject>(json); + } + + public static void SetInStored(List ids) + { + var update = new DQUpdateDom(typeof(SegmentProduction)); + update.Columns.Add(new DQUpdateColumn("InStored", true)); + update.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ID"),ids.Select(x=>DQExpression.Value(x)).ToArray())); + update.EExecute(); + } + + public static List GetProductTask(DateTime date, SegmentProduction detail) + { + var json = ButcherFactoryUtil.SecondUrlCall(ProductTaskRpc, date, detail.Goods_Code); + var task = JsonConvert.DeserializeObject(json); + + var local = GetLocalProducted(detail); + + var list = new List(); + list.Add(new ProductTask { Item = "重量", Need = task.Weight, Done = local.Weight }); + list.Add(new ProductTask { Item = "数量", Need = task.Number, Done = local.Number }); + return list; + } + + private static TaskTemp GetLocalProducted(SegmentProduction detail) + { + var local = new TaskTemp(); + var query = new DQueryDom(new JoinAlias(typeof(SegmentProduction))); + query.Columns.Add(DQSelectColumn.Sum("Weight")); + query.Columns.Add(DQSelectColumn.Count()); + query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("ProductBatch_ID", detail.ProductBatch_ID), DQCondition.EQ("Goods_ID", detail.Goods_ID))); + using (var session = DmoSession.New()) + { + using (var reader = session.ExecuteReader(query)) + { + while (reader.Read()) + { + local.Weight = (decimal?)reader[0]; + local.Number = Convert.ToDecimal(reader[1]); + } + } + } + return local; + } + public static void UploadSegmentInfo() { try @@ -245,4 +294,10 @@ namespace ButcherFactory.BO.LocalBL public DateTime? InStoreTime { get; set; } } + + class TaskTemp + { + public decimal? Weight { get; set; } + public decimal? Number { get; set; } + } } diff --git a/ButcherFactory.BO/LocalBL/SegmentSaleOutBL.cs b/ButcherFactory.BO/LocalBL/SegmentSaleOutBL.cs index 00533f3..0351367 100644 --- a/ButcherFactory.BO/LocalBL/SegmentSaleOutBL.cs +++ b/ButcherFactory.BO/LocalBL/SegmentSaleOutBL.cs @@ -136,7 +136,7 @@ namespace ButcherFactory.BO.LocalBL public static void InsertByCode(SaleOutStore_Detail orderDetail, SegmentSaleOut_Detail detail) { - var json = ButcherFactoryUtil.SimpleMESCall(MESPath + "SegmentSaleOutStoreRpc/GetSegmentInfo", detail.BarCode); + var json = ButcherFactoryUtil.SecondUrlCall(MESPath + "SegmentSaleOutStoreRpc/GetSegmentInfo", detail.BarCode); var scanInfo = JsonConvert.DeserializeObject(json); if (scanInfo.StringExt1 != orderDetail.Goods_Code) throw new Exception("扫码明细与发货明细 存货不一致!"); @@ -176,5 +176,13 @@ namespace ButcherFactory.BO.LocalBL SubmitDetails(new SegmentSaleOut_Detail[] { detail }, orderDetail, 2); } + + public static bool BarCodeUsed(string barCode) + { + var query = new DQueryDom(new JoinAlias(typeof(SegmentSaleOut_Detail))); + query.Where.Conditions.Add(DQCondition.EQ("BarCode", barCode)); + query.Columns.Add(DQSelectColumn.Create(DQExpression.Value(1), "c")); + return query.EExecuteScalar() != null; + } } } diff --git a/ButcherFactory.BO/LocalBL/SegmentStockUpBL.cs b/ButcherFactory.BO/LocalBL/SegmentStockUpBL.cs index 8c58589..fc1edb0 100644 --- a/ButcherFactory.BO/LocalBL/SegmentStockUpBL.cs +++ b/ButcherFactory.BO/LocalBL/SegmentStockUpBL.cs @@ -22,7 +22,7 @@ namespace ButcherFactory.BO.LocalBL /// GoodsCode:StringExt1,Weight:DecimalExt1 public static ExtensionObj StockUpScan(string code) { - var json = ButcherFactoryUtil.SimpleMESCall(MESPath + "SegmentInStoreRpc/StockUpScan", code); + var json = ButcherFactoryUtil.SecondUrlCall(MESPath + "SegmentInStoreRpc/StockUpScan", code); return JsonConvert.DeserializeObject(json); } diff --git a/ButcherFactory.BO/Utils/AppContext.cs b/ButcherFactory.BO/Utils/AppContext.cs index 80328c8..dab3934 100644 --- a/ButcherFactory.BO/Utils/AppContext.cs +++ b/ButcherFactory.BO/Utils/AppContext.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Xml.Serialization; namespace ButcherFactory.BO.Utils { @@ -33,7 +34,15 @@ namespace ButcherFactory.BO.Utils public int ServerMode { get; set; } - public string ServerUrl { get; set; } + public string MESUrl { get; set; } + + public string B3Url { get; set; } + + [XmlIgnore] + public string MainUrl { get { return ServerMode == 0 ? MESUrl : B3Url; } } + + [XmlIgnore] + public string SecondUrl { get { return ServerMode == 0 ? B3Url : MESUrl; } } public string SqlConnection { get; set; } diff --git a/ButcherFactory.BO/Utils/ButcherFactoryUtil.cs b/ButcherFactory.BO/Utils/ButcherFactoryUtil.cs index 51ddd3e..9948ba1 100644 --- a/ButcherFactory.BO/Utils/ButcherFactoryUtil.cs +++ b/ButcherFactory.BO/Utils/ButcherFactoryUtil.cs @@ -32,7 +32,7 @@ namespace ButcherFactory.BO.Utils static ClientRpc clientRpc; - public static T SimpleMESCall(string method, params object[] args) + public static T SecondUrlCall(string method, params object[] args) { InitClientRpc(); return clientRpc.Call(method, args); @@ -42,13 +42,9 @@ namespace ButcherFactory.BO.Utils { if (clientRpc != null) return; - var fileName = @"Config\MESUrl.cfg"; - if (!File.Exists(fileName)) - throw new Exception("缺少配置文件MESUrl.cfg"); - var url = File.ReadAllText(fileName); - if (string.IsNullOrEmpty(url)) - throw new Exception("MESUrl.cfg 配置文件错误"); - clientRpc = new ClientRpc(url); + if (string.IsNullOrEmpty(AppContext.ConnectInfo.SecondUrl)) + throw new Exception(string.Format("请先配置{0}服务器地址", AppContext.ConnectInfo.ServerMode == 0 ? "B3" : "MES")); + clientRpc = new ClientRpc(AppContext.ConnectInfo.SecondUrl); } } } diff --git a/ButcherFactory.BO/Utils/LoginUtil.cs b/ButcherFactory.BO/Utils/LoginUtil.cs index a149312..c305603 100644 --- a/ButcherFactory.BO/Utils/LoginUtil.cs +++ b/ButcherFactory.BO/Utils/LoginUtil.cs @@ -30,11 +30,11 @@ namespace ButcherFactory.BO.Utils public static void InitRpcFacade() { - if (string.IsNullOrEmpty(AppContext.ConnectInfo.ServerUrl)) + if (string.IsNullOrEmpty(AppContext.ConnectInfo.MainUrl)) throw new Exception("请先设置服务器地址"); if (!AppContext.RpcFacadeInited) { - RpcFacade.Init(AppContext.ConnectInfo.ServerUrl, "ButcherFactorySolution"); + RpcFacade.Init(AppContext.ConnectInfo.MainUrl, "ButcherFactorySolution"); AppContext.RpcFacadeInited = true; } } @@ -42,7 +42,7 @@ namespace ButcherFactory.BO.Utils public static void ReInitRpcFacade() { if (AppContext.RpcFacadeInited) - RpcFacade.ReInit(AppContext.ConnectInfo.ServerUrl); + RpcFacade.ReInit(AppContext.ConnectInfo.MainUrl); } public static string GetWorkerNameByCode(string code) @@ -112,7 +112,7 @@ namespace ButcherFactory.BO.Utils public static bool TestConnection(int? millisecondsTimeout = null) { - var url = AppContext.ConnectInfo.ServerUrl; + var url = AppContext.ConnectInfo.MainUrl; if (string.IsNullOrEmpty(url)) return false; var uri = new Uri(url); diff --git a/ButcherFactory.Form/ButcherFactory.Form.csproj b/ButcherFactory.Form/ButcherFactory.Form.csproj index 5483547..5d143c4 100644 --- a/ButcherFactory.Form/ButcherFactory.Form.csproj +++ b/ButcherFactory.Form/ButcherFactory.Form.csproj @@ -152,6 +152,12 @@ SelectStoreDialog.cs + + Form + + + WeightDeleteRecord.cs + Form @@ -285,6 +291,9 @@ SelectStoreDialog.cs + + WeightDeleteRecord.cs + WeightRecordDialog.cs diff --git a/ButcherFactory.Form/CarcassSaleOut2_/CarcassSaleOutForm.cs b/ButcherFactory.Form/CarcassSaleOut2_/CarcassSaleOutForm.cs index c8fc80f..a7f4d4f 100644 --- a/ButcherFactory.Form/CarcassSaleOut2_/CarcassSaleOutForm.cs +++ b/ButcherFactory.Form/CarcassSaleOut2_/CarcassSaleOutForm.cs @@ -157,8 +157,13 @@ namespace ButcherFactory.CarcassSaleOut2_ void uScanPanel1_AfterScan() { var barCode = uScanPanel1.TextBox.Text.Trim(); - if (!barCode.StartsWith("G") && weightRecord.Any(x => x.BarCode == barCode))//正常重复码 - return; + if (!barCode.StartsWith("G")) + { + if (weightRecord.Any(x => x.BarCode == barCode))//未提交队列里重复码 + throw new Exception("扫码重复"); + if (CarcassSaleOutBL.BarCodeUsed(barCode)) + throw new Exception("扫码重复"); + } AfterScan(barCode); } diff --git a/ButcherFactory.Form/Dialogs/WeightDeleteRecord.Designer.cs b/ButcherFactory.Form/Dialogs/WeightDeleteRecord.Designer.cs new file mode 100644 index 0000000..da5f4ec --- /dev/null +++ b/ButcherFactory.Form/Dialogs/WeightDeleteRecord.Designer.cs @@ -0,0 +1,267 @@ +namespace ButcherFactory.Dialogs +{ + partial class WeightDeleteRecord + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle(); + this.uDataGridView1 = new WinFormControl.UDataGridView(); + this.closeBtn = new ButcherFactory.Controls.ColorButton(); + this.R_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.R_Idx = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.R_BarCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.R_Goods_Code = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.R_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.R_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.R_InStoreWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.R_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.R_DiffWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.R_Operator = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.R_Time = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.R_DeleteTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.R_Deleter = new System.Windows.Forms.DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).BeginInit(); + this.SuspendLayout(); + // + // uDataGridView1 + // + this.uDataGridView1.AllowUserToAddRows = false; + this.uDataGridView1.AllowUserToDeleteRows = false; + this.uDataGridView1.AllowUserToResizeColumns = false; + this.uDataGridView1.AllowUserToResizeRows = false; + dataGridViewCellStyle22.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle22; + this.uDataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.uDataGridView1.BackgroundColor = System.Drawing.Color.White; + this.uDataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.None; + dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle23.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle23.ForeColor = System.Drawing.Color.White; + dataGridViewCellStyle23.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle23; + this.uDataGridView1.ColumnHeadersHeight = 40; + this.uDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + this.uDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.R_ID, + this.R_Idx, + this.R_BarCode, + this.R_Goods_Code, + this.R_Goods_Name, + this.R_Number, + this.R_InStoreWeight, + this.R_Weight, + this.R_DiffWeight, + this.R_Operator, + this.R_Time, + this.R_DeleteTime, + this.R_Deleter}); + this.uDataGridView1.Location = new System.Drawing.Point(12, 22); + this.uDataGridView1.MultiSelect = false; + this.uDataGridView1.Name = "uDataGridView1"; + this.uDataGridView1.ReadOnly = true; + this.uDataGridView1.RowHeadersVisible = false; + dataGridViewCellStyle28.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle28.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle28; + this.uDataGridView1.RowTemplate.Height = 40; + this.uDataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.uDataGridView1.Size = new System.Drawing.Size(1151, 434); + this.uDataGridView1.TabIndex = 1; + // + // closeBtn + // + this.closeBtn.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.closeBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245))))); + this.closeBtn.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.closeBtn.ForeColor = System.Drawing.Color.White; + this.closeBtn.Location = new System.Drawing.Point(529, 473); + this.closeBtn.Name = "closeBtn"; + this.closeBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.closeBtn.Size = new System.Drawing.Size(117, 43); + this.closeBtn.TabIndex = 4; + this.closeBtn.Text = "关闭"; + this.closeBtn.UseVisualStyleBackColor = false; + this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click); + // + // R_ID + // + this.R_ID.DataPropertyName = "ID"; + this.R_ID.HeaderText = "ID"; + this.R_ID.Name = "R_ID"; + this.R_ID.ReadOnly = true; + this.R_ID.Visible = false; + // + // R_Idx + // + this.R_Idx.DataPropertyName = "Idx"; + this.R_Idx.HeaderText = "序号"; + this.R_Idx.Name = "R_Idx"; + this.R_Idx.ReadOnly = true; + this.R_Idx.Width = 70; + // + // R_BarCode + // + this.R_BarCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.R_BarCode.DataPropertyName = "ShortCode"; + this.R_BarCode.HeaderText = "存货条码"; + this.R_BarCode.MinimumWidth = 100; + this.R_BarCode.Name = "R_BarCode"; + this.R_BarCode.ReadOnly = true; + // + // R_Goods_Code + // + this.R_Goods_Code.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.R_Goods_Code.DataPropertyName = "Goods_Code"; + this.R_Goods_Code.HeaderText = "产品编码"; + this.R_Goods_Code.MinimumWidth = 100; + this.R_Goods_Code.Name = "R_Goods_Code"; + this.R_Goods_Code.ReadOnly = true; + // + // R_Goods_Name + // + this.R_Goods_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.R_Goods_Name.DataPropertyName = "Goods_Name"; + this.R_Goods_Name.HeaderText = "产品名称"; + this.R_Goods_Name.MinimumWidth = 100; + this.R_Goods_Name.Name = "R_Goods_Name"; + this.R_Goods_Name.ReadOnly = true; + // + // R_Number + // + this.R_Number.DataPropertyName = "Number"; + dataGridViewCellStyle24.Format = "#0.######"; + this.R_Number.DefaultCellStyle = dataGridViewCellStyle24; + this.R_Number.HeaderText = "数量"; + this.R_Number.Name = "R_Number"; + this.R_Number.ReadOnly = true; + this.R_Number.Width = 70; + // + // R_InStoreWeight + // + this.R_InStoreWeight.DataPropertyName = "InStoreWeight"; + dataGridViewCellStyle25.Format = "#0.######"; + this.R_InStoreWeight.DefaultCellStyle = dataGridViewCellStyle25; + this.R_InStoreWeight.HeaderText = "入库重量"; + this.R_InStoreWeight.Name = "R_InStoreWeight"; + this.R_InStoreWeight.ReadOnly = true; + // + // R_Weight + // + this.R_Weight.DataPropertyName = "Weight"; + dataGridViewCellStyle26.Format = "#0.######"; + this.R_Weight.DefaultCellStyle = dataGridViewCellStyle26; + this.R_Weight.HeaderText = "重量"; + this.R_Weight.Name = "R_Weight"; + this.R_Weight.ReadOnly = true; + // + // R_DiffWeight + // + this.R_DiffWeight.DataPropertyName = "DiffWeight"; + dataGridViewCellStyle27.Format = "#0.######"; + this.R_DiffWeight.DefaultCellStyle = dataGridViewCellStyle27; + this.R_DiffWeight.HeaderText = "差异"; + this.R_DiffWeight.Name = "R_DiffWeight"; + this.R_DiffWeight.ReadOnly = true; + // + // R_Operator + // + this.R_Operator.DataPropertyName = "Operator"; + this.R_Operator.HeaderText = "操作员"; + this.R_Operator.Name = "R_Operator"; + this.R_Operator.ReadOnly = true; + // + // R_Time + // + this.R_Time.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.R_Time.DataPropertyName = "Time"; + this.R_Time.HeaderText = "时间"; + this.R_Time.MinimumWidth = 100; + this.R_Time.Name = "R_Time"; + this.R_Time.ReadOnly = true; + // + // R_DeleteTime + // + this.R_DeleteTime.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.R_DeleteTime.DataPropertyName = "DeleteTime"; + this.R_DeleteTime.HeaderText = "删除时间"; + this.R_DeleteTime.MinimumWidth = 100; + this.R_DeleteTime.Name = "R_DeleteTime"; + this.R_DeleteTime.ReadOnly = true; + // + // R_Deleter + // + this.R_Deleter.DataPropertyName = "Deleter"; + this.R_Deleter.HeaderText = "删除人"; + this.R_Deleter.Name = "R_Deleter"; + this.R_Deleter.ReadOnly = true; + // + // WeightDeleteRecord + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; + this.ClientSize = new System.Drawing.Size(1175, 528); + this.Controls.Add(this.closeBtn); + this.Controls.Add(this.uDataGridView1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MinimizeBox = false; + this.Name = "WeightDeleteRecord"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "删除记录"; + this.WindowState = System.Windows.Forms.FormWindowState.Maximized; + ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private WinFormControl.UDataGridView uDataGridView1; + private Controls.ColorButton closeBtn; + private System.Windows.Forms.DataGridViewTextBoxColumn R_ID; + private System.Windows.Forms.DataGridViewTextBoxColumn R_Idx; + private System.Windows.Forms.DataGridViewTextBoxColumn R_BarCode; + private System.Windows.Forms.DataGridViewTextBoxColumn R_Goods_Code; + private System.Windows.Forms.DataGridViewTextBoxColumn R_Goods_Name; + private System.Windows.Forms.DataGridViewTextBoxColumn R_Number; + private System.Windows.Forms.DataGridViewTextBoxColumn R_InStoreWeight; + private System.Windows.Forms.DataGridViewTextBoxColumn R_Weight; + private System.Windows.Forms.DataGridViewTextBoxColumn R_DiffWeight; + private System.Windows.Forms.DataGridViewTextBoxColumn R_Operator; + private System.Windows.Forms.DataGridViewTextBoxColumn R_Time; + private System.Windows.Forms.DataGridViewTextBoxColumn R_DeleteTime; + private System.Windows.Forms.DataGridViewTextBoxColumn R_Deleter; + } +} \ No newline at end of file diff --git a/ButcherFactory.Form/Dialogs/WeightDeleteRecord.cs b/ButcherFactory.Form/Dialogs/WeightDeleteRecord.cs new file mode 100644 index 0000000..1877db0 --- /dev/null +++ b/ButcherFactory.Form/Dialogs/WeightDeleteRecord.cs @@ -0,0 +1,37 @@ +using ButcherFactory.BO; +using ButcherFactory.BO.LocalBL; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ButcherFactory.Dialogs +{ + public partial class WeightDeleteRecord : Form + { + BindingList list; + public WeightDeleteRecord(long detailID) + { + InitializeComponent(); + uDataGridView1.BorderStyle = BorderStyle.FixedSingle; + BindGrid(detailID); + } + + void BindGrid(long detailID) + { + list = CarcassSaleOutBL.GetDeletedWeightRecord(detailID); + uDataGridView1.DataSource = list; + uDataGridView1.Refresh(); + } + + private void closeBtn_Click(object sender, EventArgs e) + { + this.Close(); + } + } +} diff --git a/ButcherFactory.Form/Dialogs/WeightDeleteRecord.resx b/ButcherFactory.Form/Dialogs/WeightDeleteRecord.resx new file mode 100644 index 0000000..1e08b48 --- /dev/null +++ b/ButcherFactory.Form/Dialogs/WeightDeleteRecord.resx @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/ButcherFactory.Form/Dialogs/WeightRecordDialog.Designer.cs b/ButcherFactory.Form/Dialogs/WeightRecordDialog.Designer.cs index 6837438..02adc5d 100644 --- a/ButcherFactory.Form/Dialogs/WeightRecordDialog.Designer.cs +++ b/ButcherFactory.Form/Dialogs/WeightRecordDialog.Designer.cs @@ -28,19 +28,14 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); this.uDataGridView1 = new WinFormControl.UDataGridView(); - this.panel1 = new System.Windows.Forms.Panel(); - this.closeBtn = new ButcherFactory.Controls.ColorButton(); - this.rollBackBtn = new ButcherFactory.Controls.ColorButton(); - this.deleteBtn = new ButcherFactory.Controls.ColorButton(); - this.addBtn = new ButcherFactory.Controls.ColorButton(); this.R_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.R_Selected = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.R_Image = new System.Windows.Forms.DataGridViewImageColumn(); @@ -54,6 +49,12 @@ this.R_DiffWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.R_Operator = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.R_Time = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.panel1 = new System.Windows.Forms.Panel(); + this.deleteLogBtn = new ButcherFactory.Controls.ColorButton(); + this.closeBtn = new ButcherFactory.Controls.ColorButton(); + this.rollBackBtn = new ButcherFactory.Controls.ColorButton(); + this.deleteBtn = new ButcherFactory.Controls.ColorButton(); + this.addBtn = new ButcherFactory.Controls.ColorButton(); ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).BeginInit(); this.panel1.SuspendLayout(); this.SuspendLayout(); @@ -64,18 +65,18 @@ this.uDataGridView1.AllowUserToDeleteRows = false; this.uDataGridView1.AllowUserToResizeColumns = false; this.uDataGridView1.AllowUserToResizeRows = false; - dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle8; this.uDataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.uDataGridView1.BackgroundColor = System.Drawing.Color.White; this.uDataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.None; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle9.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle9.ForeColor = System.Drawing.Color.White; + dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle9; this.uDataGridView1.ColumnHeadersHeight = 40; this.uDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.uDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { @@ -97,9 +98,9 @@ this.uDataGridView1.Name = "uDataGridView1"; this.uDataGridView1.ReadOnly = true; this.uDataGridView1.RowHeadersVisible = false; - dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle7.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle7; + dataGridViewCellStyle14.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle14.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle14; this.uDataGridView1.RowTemplate.Height = 40; this.uDataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.uDataGridView1.Size = new System.Drawing.Size(1045, 434); @@ -107,75 +108,6 @@ this.uDataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.uDataGridView1_CellClick); this.uDataGridView1.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.uDataGridView1_CellFormatting); // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.Controls.Add(this.closeBtn); - this.panel1.Controls.Add(this.rollBackBtn); - this.panel1.Controls.Add(this.deleteBtn); - this.panel1.Controls.Add(this.addBtn); - this.panel1.Location = new System.Drawing.Point(185, 468); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(744, 52); - this.panel1.TabIndex = 2; - // - // closeBtn - // - this.closeBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245))))); - this.closeBtn.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.closeBtn.ForeColor = System.Drawing.Color.White; - this.closeBtn.Location = new System.Drawing.Point(624, 5); - this.closeBtn.Name = "closeBtn"; - this.closeBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); - this.closeBtn.Size = new System.Drawing.Size(117, 43); - this.closeBtn.TabIndex = 3; - this.closeBtn.Text = "关闭"; - this.closeBtn.UseVisualStyleBackColor = false; - this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click); - // - // rollBackBtn - // - this.rollBackBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(75)))), ((int)(((byte)(71))))); - this.rollBackBtn.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.rollBackBtn.ForeColor = System.Drawing.Color.White; - this.rollBackBtn.Location = new System.Drawing.Point(428, 5); - this.rollBackBtn.Name = "rollBackBtn"; - this.rollBackBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); - this.rollBackBtn.Size = new System.Drawing.Size(117, 43); - this.rollBackBtn.TabIndex = 6; - this.rollBackBtn.Text = "退回"; - this.rollBackBtn.UseVisualStyleBackColor = false; - this.rollBackBtn.Click += new System.EventHandler(this.rollBackBtn_Click); - // - // deleteBtn - // - this.deleteBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(25))))); - this.deleteBtn.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.deleteBtn.ForeColor = System.Drawing.Color.White; - this.deleteBtn.Location = new System.Drawing.Point(207, 5); - this.deleteBtn.Name = "deleteBtn"; - this.deleteBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); - this.deleteBtn.Size = new System.Drawing.Size(117, 43); - this.deleteBtn.TabIndex = 5; - this.deleteBtn.Text = "删除且更新"; - this.deleteBtn.UseVisualStyleBackColor = false; - this.deleteBtn.Click += new System.EventHandler(this.deleteBtn_Click); - // - // addBtn - // - this.addBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(198)))), ((int)(((byte)(58))))); - this.addBtn.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.addBtn.ForeColor = System.Drawing.Color.White; - this.addBtn.Location = new System.Drawing.Point(3, 5); - this.addBtn.Name = "addBtn"; - this.addBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); - this.addBtn.Size = new System.Drawing.Size(117, 43); - this.addBtn.TabIndex = 3; - this.addBtn.Text = "新增"; - this.addBtn.UseVisualStyleBackColor = false; - this.addBtn.Click += new System.EventHandler(this.addBtn_Click); - // // R_ID // this.R_ID.DataPropertyName = "ID"; @@ -236,8 +168,8 @@ // R_Number // this.R_Number.DataPropertyName = "Number"; - dataGridViewCellStyle3.Format = "#0.######"; - this.R_Number.DefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle10.Format = "#0.######"; + this.R_Number.DefaultCellStyle = dataGridViewCellStyle10; this.R_Number.HeaderText = "数量"; this.R_Number.Name = "R_Number"; this.R_Number.ReadOnly = true; @@ -245,8 +177,8 @@ // R_InStoreWeight // this.R_InStoreWeight.DataPropertyName = "InStoreWeight"; - dataGridViewCellStyle4.Format = "#0.######"; - this.R_InStoreWeight.DefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle11.Format = "#0.######"; + this.R_InStoreWeight.DefaultCellStyle = dataGridViewCellStyle11; this.R_InStoreWeight.HeaderText = "入库重量"; this.R_InStoreWeight.Name = "R_InStoreWeight"; this.R_InStoreWeight.ReadOnly = true; @@ -254,8 +186,8 @@ // R_Weight // this.R_Weight.DataPropertyName = "Weight"; - dataGridViewCellStyle5.Format = "#0.######"; - this.R_Weight.DefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle12.Format = "#0.######"; + this.R_Weight.DefaultCellStyle = dataGridViewCellStyle12; this.R_Weight.HeaderText = "重量"; this.R_Weight.Name = "R_Weight"; this.R_Weight.ReadOnly = true; @@ -263,8 +195,8 @@ // R_DiffWeight // this.R_DiffWeight.DataPropertyName = "DiffWeight"; - dataGridViewCellStyle6.Format = "#0.######"; - this.R_DiffWeight.DefaultCellStyle = dataGridViewCellStyle6; + dataGridViewCellStyle13.Format = "#0.######"; + this.R_DiffWeight.DefaultCellStyle = dataGridViewCellStyle13; this.R_DiffWeight.HeaderText = "差异"; this.R_DiffWeight.Name = "R_DiffWeight"; this.R_DiffWeight.ReadOnly = true; @@ -285,6 +217,89 @@ this.R_Time.Name = "R_Time"; this.R_Time.ReadOnly = true; // + // panel1 + // + this.panel1.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.panel1.Controls.Add(this.deleteLogBtn); + this.panel1.Controls.Add(this.closeBtn); + this.panel1.Controls.Add(this.rollBackBtn); + this.panel1.Controls.Add(this.deleteBtn); + this.panel1.Controls.Add(this.addBtn); + this.panel1.Location = new System.Drawing.Point(54, 462); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(942, 52); + this.panel1.TabIndex = 2; + // + // deleteLogBtn + // + this.deleteLogBtn.BackColor = System.Drawing.Color.Red; + this.deleteLogBtn.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.deleteLogBtn.ForeColor = System.Drawing.Color.White; + this.deleteLogBtn.Location = new System.Drawing.Point(822, 5); + this.deleteLogBtn.Name = "deleteLogBtn"; + this.deleteLogBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.deleteLogBtn.Size = new System.Drawing.Size(117, 43); + this.deleteLogBtn.TabIndex = 7; + this.deleteLogBtn.Text = "删除记录"; + this.deleteLogBtn.UseVisualStyleBackColor = false; + this.deleteLogBtn.Click += new System.EventHandler(this.deleteLogBtn_Click); + // + // closeBtn + // + this.closeBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245))))); + this.closeBtn.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.closeBtn.ForeColor = System.Drawing.Color.White; + this.closeBtn.Location = new System.Drawing.Point(418, 5); + this.closeBtn.Name = "closeBtn"; + this.closeBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.closeBtn.Size = new System.Drawing.Size(117, 43); + this.closeBtn.TabIndex = 3; + this.closeBtn.Text = "关闭"; + this.closeBtn.UseVisualStyleBackColor = false; + this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click); + // + // rollBackBtn + // + this.rollBackBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(75)))), ((int)(((byte)(71))))); + this.rollBackBtn.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.rollBackBtn.ForeColor = System.Drawing.Color.White; + this.rollBackBtn.Location = new System.Drawing.Point(177, 5); + this.rollBackBtn.Name = "rollBackBtn"; + this.rollBackBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.rollBackBtn.Size = new System.Drawing.Size(117, 43); + this.rollBackBtn.TabIndex = 6; + this.rollBackBtn.Text = "退回"; + this.rollBackBtn.UseVisualStyleBackColor = false; + this.rollBackBtn.Click += new System.EventHandler(this.rollBackBtn_Click); + // + // deleteBtn + // + this.deleteBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(25))))); + this.deleteBtn.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.deleteBtn.ForeColor = System.Drawing.Color.White; + this.deleteBtn.Location = new System.Drawing.Point(649, 5); + this.deleteBtn.Name = "deleteBtn"; + this.deleteBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.deleteBtn.Size = new System.Drawing.Size(117, 43); + this.deleteBtn.TabIndex = 5; + this.deleteBtn.Text = "删除且更新"; + this.deleteBtn.UseVisualStyleBackColor = false; + this.deleteBtn.Click += new System.EventHandler(this.deleteBtn_Click); + // + // addBtn + // + this.addBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(198)))), ((int)(((byte)(58))))); + this.addBtn.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.addBtn.ForeColor = System.Drawing.Color.White; + this.addBtn.Location = new System.Drawing.Point(3, 5); + this.addBtn.Name = "addBtn"; + this.addBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); + this.addBtn.Size = new System.Drawing.Size(117, 43); + this.addBtn.TabIndex = 3; + this.addBtn.Text = "新增"; + this.addBtn.UseVisualStyleBackColor = false; + this.addBtn.Click += new System.EventHandler(this.addBtn_Click); + // // WeightRecordDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -326,5 +341,6 @@ private System.Windows.Forms.DataGridViewTextBoxColumn R_DiffWeight; private System.Windows.Forms.DataGridViewTextBoxColumn R_Operator; private System.Windows.Forms.DataGridViewTextBoxColumn R_Time; + private Controls.ColorButton deleteLogBtn; } } \ No newline at end of file diff --git a/ButcherFactory.Form/Dialogs/WeightRecordDialog.cs b/ButcherFactory.Form/Dialogs/WeightRecordDialog.cs index 8413acd..da5dc13 100644 --- a/ButcherFactory.Form/Dialogs/WeightRecordDialog.cs +++ b/ButcherFactory.Form/Dialogs/WeightRecordDialog.cs @@ -126,6 +126,8 @@ namespace ButcherFactory.Dialogs var id = (long)uDataGridView1.CurrentRow.Cells[0].Value; if (id == 0) return; + if (MessageBox.Show("确定删除该明细?", "删除确认", MessageBoxButtons.OKCancel) != DialogResult.OK) + return; var tag = list.First(x => x.ID == id); CarcassSaleOutBL.DeleteAndUpdate(tag); BindGrid(); @@ -174,5 +176,10 @@ namespace ButcherFactory.Dialogs Changed = true; rolBack = true; } + + private void deleteLogBtn_Click(object sender, EventArgs e) + { + new WeightDeleteRecord(mDetail.ID).ShowDialog(); + } } } diff --git a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs index 683f0e1..a534c0f 100644 --- a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs +++ b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs @@ -33,6 +33,7 @@ namespace ButcherFactory.SegmentProductionAuto_ } Thread uploadData; + Thread checkInStoreState; BindingList historyList; Dictionary> goodsSetDic; long? workUnitID; @@ -47,6 +48,8 @@ namespace ButcherFactory.SegmentProductionAuto_ { if (uploadData != null && uploadData.IsAlive) uploadData.Abort(); + if (checkInStoreState != null && checkInStoreState.IsAlive) + checkInStoreState.Abort(); }; workUnitSelect.SelectedIndexChanged += delegate { @@ -78,6 +81,9 @@ namespace ButcherFactory.SegmentProductionAuto_ var initTask = new Thread(LoadBind); initTask.Start(); + checkInStoreState = new Thread(CheckInStored); + checkInStoreState.Start(); + uploadData = new Thread(UpLoadLocalData); uploadData.Start(); } @@ -144,6 +150,7 @@ namespace ButcherFactory.SegmentProductionAuto_ weight = detail.StandardWeight.Value; } var entity = SegmentProductionBL.InsertAndSetGroupID(detail.Goods_ID, weight, workUnitID, batchID.Value, batchDate.Value); + entity.Goods_Code = detail.Goods_Code; entity.Goods_Name = detail.Goods_Name; entity.Goods_Spec = detail.Goods_Spec; GoodsLabel.Text = entity.Goods_Name; @@ -154,6 +161,9 @@ namespace ButcherFactory.SegmentProductionAuto_ historyDataGrid.Refresh(); if (barPrintCheck.Checked) NotAuto.SegmentProductionPrint.Print(entity, batchDate); + + taskDataGrid.DataSource= SegmentProductionBL.GetProductTask(batchDate ?? DateTime.Today, entity); + taskDataGrid.Refresh(); } void BindGrid() @@ -183,6 +193,35 @@ namespace ButcherFactory.SegmentProductionAuto_ } } + private void CheckInStored() + { + while (true) + { + if (this.IsHandleCreated) + { + this.Invoke(new Action(() => + { + if (netStateWatch1.NetState) + { + if (historyList.Any()) { + var arr = historyList.Reverse().Take(20).ToList(); + var inStored = SegmentProductionBL.GetInStoreState(arr.Select(x => x.BarCode).ToList()); + var tag = arr.Where(x => inStored.Contains(x.BarCode)); + if (tag.Any()) + { + SegmentProductionBL.SetInStored(tag.Select(x => x.ID).ToList()); + foreach (var item in tag) + historyList.Remove(item); + historyDataGrid.Refresh(); + } + } + } + })); + } + Thread.Sleep(5000); + } + } + private void closeBtn_Click(object sender, EventArgs e) { Close(); @@ -191,6 +230,7 @@ namespace ButcherFactory.SegmentProductionAuto_ private void goodsSetBtn_Click(object sender, EventArgs e) { new ClientGoodsSetDialog().ShowDialog(); + BindGoods(); } private void rePrintBtn_Click(object sender, EventArgs e) diff --git a/ButcherFactory.Form/SegmentSaleOut_/SegmentSaleOutForm.cs b/ButcherFactory.Form/SegmentSaleOut_/SegmentSaleOutForm.cs index 75800d2..44f7c8f 100644 --- a/ButcherFactory.Form/SegmentSaleOut_/SegmentSaleOutForm.cs +++ b/ButcherFactory.Form/SegmentSaleOut_/SegmentSaleOutForm.cs @@ -98,7 +98,9 @@ namespace ButcherFactory.SegmentSaleOut_ if (detailGridView.CurrentRow == null) throw new Exception("没有订货明细"); if (weightRecord.Any(x => x.BarCode == barCode)) - return; + throw new Exception("扫码重复"); + if (SegmentSaleOutBL.BarCodeUsed(barCode)) + throw new Exception("扫码重复"); InsertDetailByScan(barCode); diff --git a/ButcherFactory.Login/Login.xaml.cs b/ButcherFactory.Login/Login.xaml.cs index 3e5eb99..c164fb5 100644 --- a/ButcherFactory.Login/Login.xaml.cs +++ b/ButcherFactory.Login/Login.xaml.cs @@ -16,7 +16,7 @@ namespace ButcherFactory.Login { InitializeComponent(); #if DEBUG - pwdInput.Password = AppContext.ConnectInfo.ServerMode == 0 ? "123" : "bwp2017"; + pwdInput.Password = AppContext.ConnectInfo.ServerMode == 0 ? "123" : ""; #endif try diff --git a/ButcherFactory.Tools/MainWindow.xaml b/ButcherFactory.Tools/MainWindow.xaml index b2b1a33..57b6499 100644 --- a/ButcherFactory.Tools/MainWindow.xaml +++ b/ButcherFactory.Tools/MainWindow.xaml @@ -1,16 +1,18 @@  + Title="BWP_Tools" Height="450" Width="525" ResizeMode="NoResize" > -