From 4a38f9719835e5af504c18a6389dad503cfa277d Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Fri, 31 Aug 2018 14:33:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ButcherFactory.BO/Base/BaseInfo.cs | 7 +- ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs | 8 +- ButcherFactory.BO/BaseInfo/Goods.cs | 1 - ButcherFactory.BO/LocalBL/CarcassSaleOutBL.cs | 4 +- .../LocalBL/SegmentProductionBL.cs | 11 +- ButcherFactory.BO/LocalBL/SegmentSaleOutBL.cs | 2 +- ButcherFactory.BO/Rpcs/BaseInfoSyncRpc.cs | 94 ++++++-- .../CarcassInStore_/CarcassInStoreForm.cs | 2 +- .../CarcassSaleOut2_/CarcassSaleOutForm.cs | 2 +- .../CarcassSaleOut_/CarcassSaleOutForm.cs | 2 +- .../CarcassTakeOut_/CarcassTakeOutForm.cs | 2 +- .../SegmentInStore_/SegmentInStoreForm.cs | 2 +- .../SegmentPickUp_/SegmentPickUpForm.cs | 2 +- .../SegmentProductionAutoForm.Designer.cs | 200 ++++++++++-------- .../SegmentProductionAutoForm.cs | 25 ++- .../SegmentProductionForm.cs | 2 +- 16 files changed, 218 insertions(+), 148 deletions(-) diff --git a/ButcherFactory.BO/Base/BaseInfo.cs b/ButcherFactory.BO/Base/BaseInfo.cs index 7e50419..51c52a0 100644 --- a/ButcherFactory.BO/Base/BaseInfo.cs +++ b/ButcherFactory.BO/Base/BaseInfo.cs @@ -1,4 +1,5 @@ -using System; +using Forks.EnterpriseServices.DomainObjects2; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,10 +7,14 @@ using System.Threading.Tasks; namespace ButcherFactory.BO { + [KeyField("ID", KeyGenType.assigned)] public abstract class BaseInfo { public long ID { get; set; } public string Name { get; set; } + + [DbColumn(DefaultValue = 0)] + public int RowVersion { get; set; } } } diff --git a/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs b/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs index 989311a..2d2fa61 100644 --- a/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs +++ b/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs @@ -13,16 +13,10 @@ namespace ButcherFactory.BO private List mDetails = new List(); [NonDmoProperty] public List Details { get { return mDetails; } } - - private List mGoods = new List(); - [NonDmoProperty] - public List Goods { get { return mGoods; } } - - [NonDmoProperty] - public bool Stopped { get; set; } } [MapToTable("Butcher_ClientGoodsSet_Detail")] + [KeyField("ID", KeyGenType.assigned)] public class ClientGoodsSet_Detail { public long ClientGoodsSet_ID { get; set; } diff --git a/ButcherFactory.BO/BaseInfo/Goods.cs b/ButcherFactory.BO/BaseInfo/Goods.cs index 10f1bbb..40a57b9 100644 --- a/ButcherFactory.BO/BaseInfo/Goods.cs +++ b/ButcherFactory.BO/BaseInfo/Goods.cs @@ -8,7 +8,6 @@ using System.Threading.Tasks; namespace ButcherFactory.BO { [MapToTable("Butcher_Goods")] - [KeyField("ID", KeyGenType.assigned)] public class Goods : BaseInfo { public string Code { get; set; } diff --git a/ButcherFactory.BO/LocalBL/CarcassSaleOutBL.cs b/ButcherFactory.BO/LocalBL/CarcassSaleOutBL.cs index b03521b..4838f1b 100644 --- a/ButcherFactory.BO/LocalBL/CarcassSaleOutBL.cs +++ b/ButcherFactory.BO/LocalBL/CarcassSaleOutBL.cs @@ -188,9 +188,9 @@ namespace ButcherFactory.BO.LocalBL return goodsCodeInfo[code]; } - public static List GetBatchFromEMS() + public static List GetBatchFromEMS(int type) { - var json = ButcherFactoryUtil.SecondUrlCall(MESPath + "SyncBaseInfoRpc/GetProductBatch", 9); + var json = ButcherFactoryUtil.SecondUrlCall(MESPath + "SyncBaseInfoRpc/GetProductBatchByType", 9, type); return JsonConvert.DeserializeObject>(json); } diff --git a/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs b/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs index 19bca65..91e03df 100644 --- a/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs +++ b/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs @@ -76,7 +76,7 @@ namespace ButcherFactory.BO.LocalBL } } - public static SegmentProduction InsertAndSetGroupID(long goodsID, decimal weight, long? workUnitID, long productBatchID, DateTime batchDate) + public static SegmentProduction InsertAndSetGroupID(long goodsID, decimal weight, long? workUnitID, long productBatchID, DateTime batchDate,bool test) { using (var session = DmoSession.New()) { @@ -89,9 +89,12 @@ namespace ButcherFactory.BO.LocalBL entity.RowIndex = GenerateRowIndex(productBatchID, session); entity.BarCode = string.Format("260912011{0:yyyyMMdd}{1}{2:00000}", batchDate, AppContext.ConnectInfo.ClientCode, entity.RowIndex); entity.Submited = true; - session.Insert(entity); - FillGroupIDAsID(session, entity.ID); - session.Commit(); + if (!test) + { + session.Insert(entity); + FillGroupIDAsID(session, entity.ID); + session.Commit(); + } return entity; } } diff --git a/ButcherFactory.BO/LocalBL/SegmentSaleOutBL.cs b/ButcherFactory.BO/LocalBL/SegmentSaleOutBL.cs index 0351367..4c1982f 100644 --- a/ButcherFactory.BO/LocalBL/SegmentSaleOutBL.cs +++ b/ButcherFactory.BO/LocalBL/SegmentSaleOutBL.cs @@ -59,7 +59,7 @@ namespace ButcherFactory.BO.LocalBL public static List GetBatchFromEMS() { - return CarcassSaleOutBL.GetBatchFromEMS(); + return CarcassSaleOutBL.GetBatchFromEMS(1); } static void SubmitDetails(IEnumerable details, SaleOutStore_Detail detail, int flag) diff --git a/ButcherFactory.BO/Rpcs/BaseInfoSyncRpc.cs b/ButcherFactory.BO/Rpcs/BaseInfoSyncRpc.cs index b1a05fc..62035f0 100644 --- a/ButcherFactory.BO/Rpcs/BaseInfoSyncRpc.cs +++ b/ButcherFactory.BO/Rpcs/BaseInfoSyncRpc.cs @@ -1,6 +1,7 @@ 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; @@ -15,47 +16,91 @@ namespace ButcherFactory.BO.Rpcs { const string baseInfoRpcPath = @"/MainSystem/B3ClientService/Rpcs/SyncBaseInfoRpc/"; - static void TruncateTable(Type type, IDmoSession session) - { - var table = DmoInfo.Get(type).MappedDBObject; - var sql = string.Format("truncate table [{0}]", table); - session.ExecuteSqlNonQuery(sql); - } - public static void SyncBaseInfo(string methodName = null) where T : BaseInfo { var type = typeof(T); if (string.IsNullOrEmpty(methodName)) methodName = "Sync" + type.Name; - var json = RpcFacade.Call(baseInfoRpcPath + methodName); - var list = JsonConvert.DeserializeObject>(json); using (var session = DmoSession.New()) { - TruncateTable(type, session); - foreach (var item in list) + var localVersion = GetLocalVersion(session); + var json = RpcFacade.Call(baseInfoRpcPath + methodName, JsonConvert.SerializeObject(localVersion)); + var result = JsonConvert.DeserializeObject, List, List>>(json);//insert,update,delete + foreach (var item in result.Item1) session.Insert(item); + foreach (var item in result.Item2) + session.Update(item); + if (result.Item3.Any()) + Delete(session, result.Item3); + session.Commit(); + } + } + + static void Delete(IDmoSession session, List ids) + where T : BaseInfo + { + var delete = new DQDeleteDom(typeof(T)); + delete.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ID"), ids.Select(x => DQExpression.Value(x)).ToArray())); + session.ExecuteNonQuery(delete); + } + + static List> GetLocalVersion(IDmoSession session) + where T : BaseInfo + { + var query = new DQueryDom(new JoinAlias(typeof(T))); + query.Columns.Add(DQSelectColumn.Field("ID")); + query.Columns.Add(DQSelectColumn.Field("RowVersion")); + return query.EExecuteList(session); + } + + public static void SyncProductBatch(int batchType) + { + using (var session = DmoSession.New()) + { + var local = GetLocalVersion(session); + var json = RpcFacade.Call(baseInfoRpcPath + "SyncProductBatchByType", batchType, JsonConvert.SerializeObject(local)); + + var result = JsonConvert.DeserializeObject, List, List>>(json);//insert,update,delete + foreach (var item in result.Item1) + session.Insert(item); + foreach (var item in result.Item2) + session.Update(item); + if (result.Item3.Any()) + Delete(session, result.Item3); + session.Commit(); } } public static void SyncGoodsByTag(ApplyClient applyClient) { - var json = RpcFacade.Call(baseInfoRpcPath + "SyncClientGoodsSetByClient", (short)applyClient); - var list = JsonConvert.DeserializeObject>(json); using (var session = DmoSession.New()) { - foreach (var item in list) - { - DeleteOld(item.ID, session); - if (!item.Stopped) - Insert(item, session); - } + var local = GetLocalVersion(session); + var g2 = GetLocalVersion(session); + var json = RpcFacade.Call(baseInfoRpcPath + "SyncClientGoodsSetByClient", (short)applyClient, JsonConvert.SerializeObject(local), JsonConvert.SerializeObject(g2)); + + var result = JsonConvert.DeserializeObject, List, List, List, List, List>>(json);//insert,update,delete + foreach (var item in result.Item1) + Insert(item, session); + foreach (var item in result.Item2) + Update(item, session); + foreach (var item in result.Item3) + DeleteClientSet(item, session); + + foreach (var item in result.Item4) + session.Insert(item); + foreach (var item in result.Item5) + session.Update(item); + if (result.Item6.Any()) + Delete(session, result.Item6); + session.Commit(); } } - static void DeleteOld(long id, IDmoSession session) + static void DeleteClientSet(long id, IDmoSession session) { var detail = new DQDeleteDom(typeof(ClientGoodsSet_Detail)); detail.Where.Conditions.Add(DQCondition.EQ("ClientGoodsSet_ID", id)); @@ -71,8 +116,13 @@ namespace ButcherFactory.BO.Rpcs session.Insert(entity); foreach (var detail in entity.Details) session.Insert(detail); - foreach (var goods in entity.Goods) - session.AddUpdateOrInsert(goods); + } + + static void Update(ClientGoodsSet entity, IDmoSession session) + { + session.Update(entity); + foreach (var detail in entity.Details) + session.AddUpdateOrInsert(detail); } } } diff --git a/ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs b/ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs index e53b808..63299bc 100644 --- a/ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs +++ b/ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs @@ -115,7 +115,7 @@ namespace ButcherFactory.CarcassInStore_ { BaseInfoSyncRpc.SyncGoodsByTag(ApplyClient.白条出入库); BaseInfoSyncRpc.SyncBaseInfo(); - BaseInfoSyncRpc.SyncBaseInfo(); + BaseInfoSyncRpc.SyncProductBatch(0); } productBatchSelect.EBindComboBox(x => x.Date == DateTime.Today, 6, "Date"); var config = XmlUtil.DeserializeFromFile(); diff --git a/ButcherFactory.Form/CarcassSaleOut2_/CarcassSaleOutForm.cs b/ButcherFactory.Form/CarcassSaleOut2_/CarcassSaleOutForm.cs index 1855c9d..25dbaca 100644 --- a/ButcherFactory.Form/CarcassSaleOut2_/CarcassSaleOutForm.cs +++ b/ButcherFactory.Form/CarcassSaleOut2_/CarcassSaleOutForm.cs @@ -111,7 +111,7 @@ namespace ButcherFactory.CarcassSaleOut2_ private void BindProductBatch() { - var batchs = CarcassSaleOutBL.GetBatchFromEMS(); + var batchs = CarcassSaleOutBL.GetBatchFromEMS(0); productBatchSelect.DisplayMember = "Name"; productBatchSelect.ValueMember = "ID"; diff --git a/ButcherFactory.Form/CarcassSaleOut_/CarcassSaleOutForm.cs b/ButcherFactory.Form/CarcassSaleOut_/CarcassSaleOutForm.cs index be5ed8b..ee9792b 100644 --- a/ButcherFactory.Form/CarcassSaleOut_/CarcassSaleOutForm.cs +++ b/ButcherFactory.Form/CarcassSaleOut_/CarcassSaleOutForm.cs @@ -110,7 +110,7 @@ namespace ButcherFactory.CarcassSaleOut_ private void BindProductBatch() { - var batchs = CarcassSaleOutBL.GetBatchFromEMS(); + var batchs = CarcassSaleOutBL.GetBatchFromEMS(0); productBatchSelect.DisplayMember = "Name"; productBatchSelect.ValueMember = "ID"; diff --git a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.cs b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.cs index 66b9761..1b04262 100644 --- a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.cs +++ b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.cs @@ -92,7 +92,7 @@ namespace ButcherFactory.CarcassTakeOut_ { BaseInfoSyncRpc.SyncGoodsByTag(ApplyClient.白条出入库); BaseInfoSyncRpc.SyncBaseInfo(); - BaseInfoSyncRpc.SyncBaseInfo(); + BaseInfoSyncRpc.SyncProductBatch(0); } productBatchSelect.EBindComboBox(x => x.Date == DateTime.Today, 6, "Date"); diff --git a/ButcherFactory.Form/SegmentInStore_/SegmentInStoreForm.cs b/ButcherFactory.Form/SegmentInStore_/SegmentInStoreForm.cs index 227f0a7..f580955 100644 --- a/ButcherFactory.Form/SegmentInStore_/SegmentInStoreForm.cs +++ b/ButcherFactory.Form/SegmentInStore_/SegmentInStoreForm.cs @@ -75,7 +75,7 @@ namespace ButcherFactory.SegmentInStore_ if (netStateWatch1.NetState) { BaseInfoSyncRpc.SyncBaseInfo(); - BaseInfoSyncRpc.SyncBaseInfo(); + BaseInfoSyncRpc.SyncProductBatch(1); BaseInfoSyncRpc.SyncBaseInfo(); } var config = XmlUtil.DeserializeFromFile(); diff --git a/ButcherFactory.Form/SegmentPickUp_/SegmentPickUpForm.cs b/ButcherFactory.Form/SegmentPickUp_/SegmentPickUpForm.cs index 89a70ec..ad7069f 100644 --- a/ButcherFactory.Form/SegmentPickUp_/SegmentPickUpForm.cs +++ b/ButcherFactory.Form/SegmentPickUp_/SegmentPickUpForm.cs @@ -92,7 +92,7 @@ namespace ButcherFactory.SegmentPickUp_ { BaseInfoSyncRpc.SyncGoodsByTag(ApplyClient.分割领用); BaseInfoSyncRpc.SyncBaseInfo(); - BaseInfoSyncRpc.SyncBaseInfo(); + BaseInfoSyncRpc.SyncProductBatch(1); } productBatchSelect.EBindComboBox(x => x.Date == DateTime.Today, 6, "Date"); diff --git a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs index cfa83df..66020f0 100644 --- a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs +++ b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs @@ -28,16 +28,16 @@ /// 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 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 dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = 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 dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle(); this.uLabel3 = new WinFormControl.ULabel(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.taskDataGrid = new WinFormControl.UDataGridView(); @@ -47,6 +47,8 @@ this.T_Last = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.GoodsLabel = new WinFormControl.ULabel(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.closeBtn = new ButcherFactory.Controls.ColorButton(); + this.uWeightControl1 = new ButcherFactory.Controls.WeightControl(); this.barPrintCheck = new System.Windows.Forms.CheckBox(); this.uTimerLabel1 = new WinFormControl.UTimerLabel(); this.productBatchSelect = new System.Windows.Forms.ComboBox(); @@ -55,8 +57,10 @@ this.uLabel2 = new WinFormControl.ULabel(); this.netStateWatch1 = new WinFormControl.NetStateWatch(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); + this.goodsSetBtn = new ButcherFactory.Controls.ColorButton(); this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.rePrintBtn = new ButcherFactory.Controls.ColorButton(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.historyDataGrid = new WinFormControl.UDataGridView(); this.H_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -64,10 +68,7 @@ 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.closeBtn = new ButcherFactory.Controls.ColorButton(); - this.uWeightControl1 = new ButcherFactory.Controls.WeightControl(); - this.goodsSetBtn = new ButcherFactory.Controls.ColorButton(); - this.rePrintBtn = new ButcherFactory.Controls.ColorButton(); + this.testCkBox = new System.Windows.Forms.CheckBox(); this.groupBox2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.taskDataGrid)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); @@ -110,15 +111,15 @@ this.taskDataGrid.AllowUserToDeleteRows = false; this.taskDataGrid.AllowUserToResizeColumns = false; this.taskDataGrid.AllowUserToResizeRows = false; - dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.taskDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle21.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.taskDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle21; this.taskDataGrid.BackgroundColor = System.Drawing.Color.White; this.taskDataGrid.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.taskDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle22.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle22.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle22.ForeColor = System.Drawing.Color.White; + dataGridViewCellStyle22.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.taskDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle22; this.taskDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.taskDataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.T_Item, @@ -131,9 +132,9 @@ this.taskDataGrid.Name = "taskDataGrid"; this.taskDataGrid.ReadOnly = true; this.taskDataGrid.RowHeadersVisible = false; - dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.taskDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle6; + dataGridViewCellStyle26.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle26.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.taskDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle26; this.taskDataGrid.RowTemplate.Height = 23; this.taskDataGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.taskDataGrid.Size = new System.Drawing.Size(442, 96); @@ -150,8 +151,8 @@ // this.T_Need.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.T_Need.DataPropertyName = "Need"; - dataGridViewCellStyle3.Format = "#0.######"; - this.T_Need.DefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle23.Format = "#0.######"; + this.T_Need.DefaultCellStyle = dataGridViewCellStyle23; this.T_Need.HeaderText = "订货"; this.T_Need.Name = "T_Need"; this.T_Need.ReadOnly = true; @@ -160,8 +161,8 @@ // this.T_Done.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.T_Done.DataPropertyName = "Done"; - dataGridViewCellStyle4.Format = "#0.######"; - this.T_Done.DefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle24.Format = "#0.######"; + this.T_Done.DefaultCellStyle = dataGridViewCellStyle24; this.T_Done.HeaderText = "完工"; this.T_Done.Name = "T_Done"; this.T_Done.ReadOnly = true; @@ -170,8 +171,8 @@ // this.T_Last.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.T_Last.DataPropertyName = "Last"; - dataGridViewCellStyle5.Format = "#0.######"; - this.T_Last.DefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle25.Format = "#0.######"; + this.T_Last.DefaultCellStyle = dataGridViewCellStyle25; this.T_Last.HeaderText = "剩余"; this.T_Last.Name = "T_Last"; this.T_Last.ReadOnly = true; @@ -202,6 +203,7 @@ // this.splitContainer1.Panel1.Controls.Add(this.closeBtn); this.splitContainer1.Panel1.Controls.Add(this.uWeightControl1); + this.splitContainer1.Panel1.Controls.Add(this.testCkBox); this.splitContainer1.Panel1.Controls.Add(this.barPrintCheck); this.splitContainer1.Panel1.Controls.Add(this.uTimerLabel1); this.splitContainer1.Panel1.Controls.Add(this.productBatchSelect); @@ -217,6 +219,30 @@ this.splitContainer1.SplitterDistance = 87; this.splitContainer1.TabIndex = 1; // + // closeBtn + // + this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.closeBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(25))))); + this.closeBtn.Font = new System.Drawing.Font("宋体", 15F); + this.closeBtn.ForeColor = System.Drawing.Color.White; + this.closeBtn.Location = new System.Drawing.Point(1109, 7); + this.closeBtn.Name = "closeBtn"; + this.closeBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); + this.closeBtn.Size = new System.Drawing.Size(111, 41); + this.closeBtn.TabIndex = 18; + this.closeBtn.Text = "关闭"; + this.closeBtn.UseVisualStyleBackColor = false; + this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click); + // + // uWeightControl1 + // + this.uWeightControl1.BackColor = System.Drawing.Color.Transparent; + this.uWeightControl1.Location = new System.Drawing.Point(12, 7); + this.uWeightControl1.Name = "uWeightControl1"; + this.uWeightControl1.Size = new System.Drawing.Size(262, 74); + this.uWeightControl1.TabIndex = 17; + this.uWeightControl1.WeightFalg = null; + // // barPrintCheck // this.barPrintCheck.AutoSize = true; @@ -316,6 +342,21 @@ this.splitContainer2.SplitterDistance = 761; this.splitContainer2.TabIndex = 0; // + // goodsSetBtn + // + this.goodsSetBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.goodsSetBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245))))); + this.goodsSetBtn.Font = new System.Drawing.Font("宋体", 15F); + this.goodsSetBtn.ForeColor = System.Drawing.Color.White; + this.goodsSetBtn.Location = new System.Drawing.Point(645, 3); + this.goodsSetBtn.Name = "goodsSetBtn"; + this.goodsSetBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); + this.goodsSetBtn.Size = new System.Drawing.Size(111, 62); + this.goodsSetBtn.TabIndex = 19; + this.goodsSetBtn.Text = "产品设置"; + this.goodsSetBtn.UseVisualStyleBackColor = false; + this.goodsSetBtn.Click += new System.EventHandler(this.goodsSetBtn_Click); + // // flowLayoutPanel2 // this.flowLayoutPanel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -338,6 +379,20 @@ this.flowLayoutPanel1.Size = new System.Drawing.Size(640, 70); this.flowLayoutPanel1.TabIndex = 22; // + // rePrintBtn + // + this.rePrintBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(144)))), ((int)(((byte)(98)))), ((int)(((byte)(222))))); + this.rePrintBtn.Font = new System.Drawing.Font("宋体", 15F); + this.rePrintBtn.ForeColor = System.Drawing.Color.White; + this.rePrintBtn.Location = new System.Drawing.Point(338, 129); + this.rePrintBtn.Name = "rePrintBtn"; + this.rePrintBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); + this.rePrintBtn.Size = new System.Drawing.Size(111, 41); + this.rePrintBtn.TabIndex = 22; + this.rePrintBtn.Text = "补打"; + this.rePrintBtn.UseVisualStyleBackColor = false; + this.rePrintBtn.Click += new System.EventHandler(this.rePrintBtn_Click); + // // groupBox1 // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -357,15 +412,15 @@ this.historyDataGrid.AllowUserToDeleteRows = false; this.historyDataGrid.AllowUserToResizeColumns = false; this.historyDataGrid.AllowUserToResizeRows = false; - dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.historyDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7; + dataGridViewCellStyle27.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.historyDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle27; this.historyDataGrid.BackgroundColor = System.Drawing.Color.White; this.historyDataGrid.BorderStyle = System.Windows.Forms.BorderStyle.None; - dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle8.ForeColor = System.Drawing.Color.White; - dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.historyDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8; + dataGridViewCellStyle28.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle28.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle28.ForeColor = System.Drawing.Color.White; + dataGridViewCellStyle28.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.historyDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle28; this.historyDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.historyDataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.H_ID, @@ -379,9 +434,9 @@ this.historyDataGrid.Name = "historyDataGrid"; this.historyDataGrid.ReadOnly = true; this.historyDataGrid.RowHeadersVisible = false; - dataGridViewCellStyle10.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle10.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.historyDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle10; + dataGridViewCellStyle30.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle30.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.historyDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle30; this.historyDataGrid.RowTemplate.Height = 23; this.historyDataGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.historyDataGrid.Size = new System.Drawing.Size(437, 308); @@ -422,64 +477,22 @@ // H_Weight // this.H_Weight.DataPropertyName = "Weight"; - dataGridViewCellStyle9.Format = "#0.######"; - this.H_Weight.DefaultCellStyle = dataGridViewCellStyle9; + dataGridViewCellStyle29.Format = "#0.######"; + this.H_Weight.DefaultCellStyle = dataGridViewCellStyle29; this.H_Weight.HeaderText = "重量"; this.H_Weight.Name = "H_Weight"; this.H_Weight.ReadOnly = true; // - // closeBtn - // - this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.closeBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(25))))); - this.closeBtn.Font = new System.Drawing.Font("宋体", 15F); - this.closeBtn.ForeColor = System.Drawing.Color.White; - this.closeBtn.Location = new System.Drawing.Point(1109, 7); - this.closeBtn.Name = "closeBtn"; - this.closeBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); - this.closeBtn.Size = new System.Drawing.Size(111, 41); - this.closeBtn.TabIndex = 18; - this.closeBtn.Text = "关闭"; - this.closeBtn.UseVisualStyleBackColor = false; - this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click); - // - // uWeightControl1 - // - this.uWeightControl1.BackColor = System.Drawing.Color.Transparent; - this.uWeightControl1.Location = new System.Drawing.Point(12, 7); - this.uWeightControl1.Name = "uWeightControl1"; - this.uWeightControl1.Size = new System.Drawing.Size(262, 74); - this.uWeightControl1.TabIndex = 17; - this.uWeightControl1.WeightFalg = null; - // - // goodsSetBtn - // - this.goodsSetBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.goodsSetBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245))))); - this.goodsSetBtn.Font = new System.Drawing.Font("宋体", 15F); - this.goodsSetBtn.ForeColor = System.Drawing.Color.White; - this.goodsSetBtn.Location = new System.Drawing.Point(645, 3); - this.goodsSetBtn.Name = "goodsSetBtn"; - this.goodsSetBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); - this.goodsSetBtn.Size = new System.Drawing.Size(111, 62); - this.goodsSetBtn.TabIndex = 19; - this.goodsSetBtn.Text = "产品设置"; - this.goodsSetBtn.UseVisualStyleBackColor = false; - this.goodsSetBtn.Click += new System.EventHandler(this.goodsSetBtn_Click); - // - // rePrintBtn + // testCkBox // - this.rePrintBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(144)))), ((int)(((byte)(98)))), ((int)(((byte)(222))))); - this.rePrintBtn.Font = new System.Drawing.Font("宋体", 15F); - this.rePrintBtn.ForeColor = System.Drawing.Color.White; - this.rePrintBtn.Location = new System.Drawing.Point(338, 129); - this.rePrintBtn.Name = "rePrintBtn"; - this.rePrintBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); - this.rePrintBtn.Size = new System.Drawing.Size(111, 41); - this.rePrintBtn.TabIndex = 22; - this.rePrintBtn.Text = "补打"; - this.rePrintBtn.UseVisualStyleBackColor = false; - this.rePrintBtn.Click += new System.EventHandler(this.rePrintBtn_Click); + this.testCkBox.AutoSize = true; + this.testCkBox.Font = new System.Drawing.Font("宋体", 15F); + this.testCkBox.Location = new System.Drawing.Point(648, 13); + this.testCkBox.Name = "testCkBox"; + this.testCkBox.Size = new System.Drawing.Size(108, 24); + this.testCkBox.TabIndex = 16; + this.testCkBox.Text = "生产测试"; + this.testCkBox.UseVisualStyleBackColor = true; // // SegmentProductionAutoForm // @@ -542,5 +555,6 @@ private Controls.ColorButton rePrintBtn; private Controls.ColorButton closeBtn; private Controls.ColorButton goodsSetBtn; + private System.Windows.Forms.CheckBox testCkBox; } } \ No newline at end of file diff --git a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs index a534c0f..948c858 100644 --- a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs +++ b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs @@ -96,7 +96,7 @@ namespace ButcherFactory.SegmentProductionAuto_ { BaseInfoSyncRpc.SyncGoodsByTag(ApplyClient.分割品); BaseInfoSyncRpc.SyncBaseInfo(); - BaseInfoSyncRpc.SyncBaseInfo(); + BaseInfoSyncRpc.SyncProductBatch(1); } productBatchSelect.EBindComboBox(x => x.Date == DateTime.Today, 6, "Date"); var config = XmlUtil.DeserializeFromFile(); @@ -149,21 +149,26 @@ namespace ButcherFactory.SegmentProductionAuto_ throw new Exception(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", detail.StandardWeightLow, detail.StandardWeightUp)); weight = detail.StandardWeight.Value; } - var entity = SegmentProductionBL.InsertAndSetGroupID(detail.Goods_ID, weight, workUnitID, batchID.Value, batchDate.Value); + var entity = SegmentProductionBL.InsertAndSetGroupID(detail.Goods_ID, weight, workUnitID, batchID.Value, batchDate.Value,testCkBox.Checked); entity.Goods_Code = detail.Goods_Code; entity.Goods_Name = detail.Goods_Name; entity.Goods_Spec = detail.Goods_Spec; GoodsLabel.Text = entity.Goods_Name; - historyList.Insert(0, entity); - if (historyList.Count > 100) - historyList.RemoveAt(100); - historyDataGrid.FirstDisplayedScrollingRowIndex = 0; - historyDataGrid.Refresh(); + if (!testCkBox.Checked) + { + historyList.Insert(0, entity); + if (historyList.Count > 100) + historyList.RemoveAt(100); + historyDataGrid.FirstDisplayedScrollingRowIndex = 0; + historyDataGrid.Refresh(); + } if (barPrintCheck.Checked) NotAuto.SegmentProductionPrint.Print(entity, batchDate); - - taskDataGrid.DataSource= SegmentProductionBL.GetProductTask(batchDate ?? DateTime.Today, entity); - taskDataGrid.Refresh(); + if (!testCkBox.Checked) + { + taskDataGrid.DataSource = SegmentProductionBL.GetProductTask(batchDate ?? DateTime.Today, entity); + taskDataGrid.Refresh(); + } } void BindGrid() diff --git a/ButcherFactory.Form/SegmentProduction_/SegmentProductionForm.cs b/ButcherFactory.Form/SegmentProduction_/SegmentProductionForm.cs index 641a04a..1072e08 100644 --- a/ButcherFactory.Form/SegmentProduction_/SegmentProductionForm.cs +++ b/ButcherFactory.Form/SegmentProduction_/SegmentProductionForm.cs @@ -96,7 +96,7 @@ namespace ButcherFactory.SegmentProduction_ { BaseInfoSyncRpc.SyncGoodsByTag(ApplyClient.分割品); BaseInfoSyncRpc.SyncBaseInfo(); - BaseInfoSyncRpc.SyncBaseInfo(); + BaseInfoSyncRpc.SyncProductBatch(1); } productBatchSelect.EBindComboBox(x => x.Date == DateTime.Today, 6, "Date"); var config = XmlUtil.DeserializeFromFile();