diff --git a/SegmentationWeight/Rpc/Dto/SegmentationWeightRecord.cs b/SegmentationWeight/Rpc/Dto/SegmentationWeightRecord.cs index 623d5c9..2669008 100644 --- a/SegmentationWeight/Rpc/Dto/SegmentationWeightRecord.cs +++ b/SegmentationWeight/Rpc/Dto/SegmentationWeightRecord.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using AutoMapper; using BO.BO; +using Forks.EnterpriseServices.DataForm; using Forks.EnterpriseServices.DomainObjects2; using Newtonsoft.Json; @@ -12,6 +13,7 @@ namespace SegmentationWeight.Rpc.Dto { [Serializable] [MapToTable("SegmentationWeightRecord")] + [DFClass] public class SegmentationWeightRecord: LocalSyncBase { public string BarCode { get; set; }//条码 @@ -21,6 +23,7 @@ namespace SegmentationWeight.Rpc.Dto public decimal Weight { get; set; }//皮重 public string CardBarCode{ get; set; }//放产品的车的条码 public string BiaoShi { get; set; } + public string ProductBatch { get; set; } public override string GetDtoJson() { var config = new MapperConfiguration(cfg => { diff --git a/SegmentationWeight/Rpc/Dto/SegmentationWeightRecordDto.cs b/SegmentationWeight/Rpc/Dto/SegmentationWeightRecordDto.cs index 758ede8..403a47c 100644 --- a/SegmentationWeight/Rpc/Dto/SegmentationWeightRecordDto.cs +++ b/SegmentationWeight/Rpc/Dto/SegmentationWeightRecordDto.cs @@ -4,9 +4,11 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using BO.BO.Dtos; +using Forks.EnterpriseServices.DataForm; namespace SegmentationWeight.Rpc.Dto { + [DFClass] public class SegmentationWeightRecordDto: SyncBaseDto { public string BarCode { get; set; }//条码 @@ -16,5 +18,6 @@ namespace SegmentationWeight.Rpc.Dto public decimal Weight { get; set; }//皮重 public string CardBarCode { get; set; }//放产品的车的条码 public string BiaoShi { get; set; } + public string ProductBatch { get; set; } } } diff --git a/SegmentationWeight/SegmentationWeightForm.Designer.cs b/SegmentationWeight/SegmentationWeightForm.Designer.cs index dd9557a..6376361 100644 --- a/SegmentationWeight/SegmentationWeightForm.Designer.cs +++ b/SegmentationWeight/SegmentationWeightForm.Designer.cs @@ -49,17 +49,28 @@ this.flpGoods = new System.Windows.Forms.FlowLayoutPanel(); this.flpClass = new System.Windows.Forms.FlowLayoutPanel(); this.uDataGridView1 = new BWP.WinFormControl.UDataGridView(); + this.序号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.条码 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.产品 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.重量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.lblGoodsName = new System.Windows.Forms.Label(); this.lblNumber = new System.Windows.Forms.Label(); this.lblWeight = new System.Windows.Forms.Label(); - this.序号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.条码 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.产品 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.重量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.label7 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.lblPlanNumber = new System.Windows.Forms.Label(); + this.lblPlanWeight = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.lblLeftWeight = new System.Windows.Forms.Label(); + this.lblLeftNumber = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.picNetStatus = new System.Windows.Forms.PictureBox(); + this.picSyncStatus = new System.Windows.Forms.PictureBox(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -73,6 +84,8 @@ this.splitContainer2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).BeginInit(); this.tableLayoutPanel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.picNetStatus)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picSyncStatus)).BeginInit(); this.SuspendLayout(); // // splitContainer1 @@ -98,6 +111,10 @@ // // panel1 // + this.panel1.Controls.Add(this.picSyncStatus); + this.panel1.Controls.Add(this.picNetStatus); + this.panel1.Controls.Add(this.label11); + this.panel1.Controls.Add(this.label10); this.panel1.Controls.Add(this.panel3); this.panel1.Controls.Add(this.enableWeight); this.panel1.Controls.Add(this.panel2); @@ -296,7 +313,8 @@ dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; - this.uDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.uDataGridView1.ColumnHeadersHeight = 40; + this.uDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.uDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.序号, this.条码, @@ -312,52 +330,84 @@ this.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle3; this.uDataGridView1.RowTemplate.Height = 23; this.uDataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.uDataGridView1.Size = new System.Drawing.Size(515, 363); + this.uDataGridView1.Size = new System.Drawing.Size(518, 363); this.uDataGridView1.TabIndex = 1; // + // 序号 + // + this.序号.DataPropertyName = "ID"; + this.序号.HeaderText = "序号"; + this.序号.Name = "序号"; + this.序号.ReadOnly = true; + this.序号.Width = 80; + // + // 条码 + // + this.条码.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.条码.DataPropertyName = "BarCode"; + this.条码.HeaderText = "条码"; + this.条码.Name = "条码"; + this.条码.ReadOnly = true; + this.条码.Width = 60; + // + // 产品 + // + this.产品.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.产品.DataPropertyName = "Goods_Name"; + this.产品.HeaderText = "产品"; + this.产品.MinimumWidth = 100; + this.产品.Name = "产品"; + this.产品.ReadOnly = true; + // + // 重量 + // + this.重量.DataPropertyName = "Weight"; + this.重量.HeaderText = "重量"; + this.重量.Name = "重量"; + this.重量.ReadOnly = true; + this.重量.Width = 80; + // // tableLayoutPanel1 // this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tableLayoutPanel1.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single; - this.tableLayoutPanel1.ColumnCount = 3; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 58.15603F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 41.84397F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 124F)); - this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.label2, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.label3, 2, 0); + this.tableLayoutPanel1.ColumnCount = 5; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 75.76792F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 24.23208F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 82F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 67F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 71F)); this.tableLayoutPanel1.Controls.Add(this.lblGoodsName, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.lblNumber, 1, 1); - this.tableLayoutPanel1.Controls.Add(this.lblWeight, 2, 1); + this.tableLayoutPanel1.Controls.Add(this.label8, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.label3, 1, 1); + this.tableLayoutPanel1.Controls.Add(this.label2, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.label7, 4, 0); + this.tableLayoutPanel1.Controls.Add(this.label9, 3, 0); + this.tableLayoutPanel1.Controls.Add(this.lblPlanWeight, 2, 1); + this.tableLayoutPanel1.Controls.Add(this.lblNumber, 3, 2); + this.tableLayoutPanel1.Controls.Add(this.lblWeight, 3, 1); + this.tableLayoutPanel1.Controls.Add(this.lblPlanNumber, 2, 2); + this.tableLayoutPanel1.Controls.Add(this.label1, 2, 0); + this.tableLayoutPanel1.Controls.Add(this.lblLeftWeight, 4, 1); + this.tableLayoutPanel1.Controls.Add(this.lblLeftNumber, 4, 2); this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 4); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 2; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 53.57143F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 46.42857F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(515, 98); + this.tableLayoutPanel1.RowCount = 3; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(518, 98); this.tableLayoutPanel1.TabIndex = 0; // - // label1 - // - this.label1.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.label1.Location = new System.Drawing.Point(4, 1); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(219, 50); - this.label1.TabIndex = 0; - this.label1.Text = "产品"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // // label2 // this.label2.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.label2.Location = new System.Drawing.Point(230, 1); + this.label2.Location = new System.Drawing.Point(226, 65); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(155, 50); + this.label2.Size = new System.Drawing.Size(64, 32); this.label2.TabIndex = 0; this.label2.Text = "数量"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -367,9 +417,9 @@ this.label3.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.label3.Location = new System.Drawing.Point(392, 1); + this.label3.Location = new System.Drawing.Point(226, 33); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(119, 50); + this.label3.Size = new System.Drawing.Size(64, 31); this.label3.TabIndex = 0; this.label3.Text = "重量"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -379,9 +429,9 @@ this.lblGoodsName.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.lblGoodsName.Location = new System.Drawing.Point(4, 52); + this.lblGoodsName.Location = new System.Drawing.Point(4, 33); this.lblGoodsName.Name = "lblGoodsName"; - this.lblGoodsName.Size = new System.Drawing.Size(219, 45); + this.lblGoodsName.Size = new System.Drawing.Size(215, 31); this.lblGoodsName.TabIndex = 0; this.lblGoodsName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // @@ -390,9 +440,9 @@ this.lblNumber.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.lblNumber.Location = new System.Drawing.Point(230, 52); + this.lblNumber.Location = new System.Drawing.Point(380, 65); this.lblNumber.Name = "lblNumber"; - this.lblNumber.Size = new System.Drawing.Size(155, 45); + this.lblNumber.Size = new System.Drawing.Size(61, 32); this.lblNumber.TabIndex = 0; this.lblNumber.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // @@ -401,45 +451,141 @@ this.lblWeight.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.lblWeight.Location = new System.Drawing.Point(392, 52); + this.lblWeight.Location = new System.Drawing.Point(380, 33); this.lblWeight.Name = "lblWeight"; - this.lblWeight.Size = new System.Drawing.Size(119, 45); + this.lblWeight.Size = new System.Drawing.Size(61, 31); this.lblWeight.TabIndex = 0; this.lblWeight.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // 序号 + // label7 // - this.序号.DataPropertyName = "ID"; - this.序号.HeaderText = "序号"; - this.序号.Name = "序号"; - this.序号.ReadOnly = true; - this.序号.Width = 80; + this.label7.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.label7.Location = new System.Drawing.Point(448, 1); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(66, 31); + this.label7.TabIndex = 0; + this.label7.Text = "剩余"; + this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // 条码 + // label1 // - this.条码.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; - this.条码.DataPropertyName = "BarCode"; - this.条码.HeaderText = "条码"; - this.条码.Name = "条码"; - this.条码.ReadOnly = true; - this.条码.Width = 65; + this.label1.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.label1.Location = new System.Drawing.Point(297, 1); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(76, 31); + this.label1.TabIndex = 0; + this.label1.Text = "订货"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // 产品 + // label8 // - this.产品.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.产品.DataPropertyName = "Goods_Name"; - this.产品.HeaderText = "产品"; - this.产品.MinimumWidth = 100; - this.产品.Name = "产品"; - this.产品.ReadOnly = true; + this.label8.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.label8.Location = new System.Drawing.Point(4, 1); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(215, 31); + this.label8.TabIndex = 0; + this.label8.Text = "产品"; + this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // 重量 + // lblPlanNumber // - this.重量.DataPropertyName = "Weight"; - this.重量.HeaderText = "重量"; - this.重量.Name = "重量"; - this.重量.ReadOnly = true; - this.重量.Width = 80; + this.lblPlanNumber.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.lblPlanNumber.Location = new System.Drawing.Point(297, 65); + this.lblPlanNumber.Name = "lblPlanNumber"; + this.lblPlanNumber.Size = new System.Drawing.Size(76, 32); + this.lblPlanNumber.TabIndex = 0; + this.lblPlanNumber.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblPlanWeight + // + this.lblPlanWeight.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.lblPlanWeight.Location = new System.Drawing.Point(297, 33); + this.lblPlanWeight.Name = "lblPlanWeight"; + this.lblPlanWeight.Size = new System.Drawing.Size(76, 31); + this.lblPlanWeight.TabIndex = 0; + this.lblPlanWeight.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label9 + // + this.label9.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.label9.Location = new System.Drawing.Point(380, 1); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(61, 31); + this.label9.TabIndex = 0; + this.label9.Text = "完工"; + this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblLeftWeight + // + this.lblLeftWeight.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.lblLeftWeight.Location = new System.Drawing.Point(448, 33); + this.lblLeftWeight.Name = "lblLeftWeight"; + this.lblLeftWeight.Size = new System.Drawing.Size(66, 31); + this.lblLeftWeight.TabIndex = 0; + this.lblLeftWeight.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblLeftNumber + // + this.lblLeftNumber.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.lblLeftNumber.Location = new System.Drawing.Point(448, 65); + this.lblLeftNumber.Name = "lblLeftNumber"; + this.lblLeftNumber.Size = new System.Drawing.Size(66, 32); + this.lblLeftNumber.TabIndex = 0; + this.lblLeftNumber.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(424, 19); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(29, 12); + this.label10.TabIndex = 35; + this.label10.Text = "网络"; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(424, 67); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(29, 12); + this.label11.TabIndex = 35; + this.label11.Text = "同步"; + // + // picNetStatus + // + this.picNetStatus.ErrorImage = null; + this.picNetStatus.InitialImage = null; + this.picNetStatus.Location = new System.Drawing.Point(459, 11); + this.picNetStatus.Name = "picNetStatus"; + this.picNetStatus.Size = new System.Drawing.Size(30, 30); + this.picNetStatus.TabIndex = 39; + this.picNetStatus.TabStop = false; + // + // picSyncStatus + // + this.picSyncStatus.ErrorImage = null; + this.picSyncStatus.InitialImage = null; + this.picSyncStatus.Location = new System.Drawing.Point(459, 56); + this.picSyncStatus.Name = "picSyncStatus"; + this.picSyncStatus.Size = new System.Drawing.Size(30, 30); + this.picSyncStatus.TabIndex = 39; + this.picSyncStatus.TabStop = false; // // SegmentationWeightForm // @@ -469,6 +615,8 @@ this.splitContainer2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).EndInit(); this.tableLayoutPanel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.picNetStatus)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picSyncStatus)).EndInit(); this.ResumeLayout(false); } @@ -504,5 +652,16 @@ private System.Windows.Forms.DataGridViewTextBoxColumn 条码; private System.Windows.Forms.DataGridViewTextBoxColumn 产品; private System.Windows.Forms.DataGridViewTextBoxColumn 重量; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label lblPlanWeight; + private System.Windows.Forms.Label lblPlanNumber; + private System.Windows.Forms.Label lblLeftWeight; + private System.Windows.Forms.Label lblLeftNumber; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.PictureBox picSyncStatus; + private System.Windows.Forms.PictureBox picNetStatus; } } \ No newline at end of file diff --git a/SegmentationWeight/SegmentationWeightForm.cs b/SegmentationWeight/SegmentationWeightForm.cs index e64f730..82d6e03 100644 --- a/SegmentationWeight/SegmentationWeightForm.cs +++ b/SegmentationWeight/SegmentationWeightForm.cs @@ -4,8 +4,10 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; +using System.IO; using System.IO.Ports; using System.Linq; +using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -21,11 +23,10 @@ using SegmentationWeight.Rpc.Dto; namespace SegmentationWeight { - public partial class SegmentationWeightForm : Form,IAfterLogin + public partial class SegmentationWeightForm : Form, IAfterLogin { private readonly string mDropDownSetsFileName = "DropDownSets.xml"; private DropDownSets mDropDownSets; - private List mProductTasks; private readonly string mProductTasksFileName = "ProductTasks.xml"; @@ -38,9 +39,14 @@ namespace SegmentationWeight #endregion private List mSetList; + BindingList mWeightRecords; + private bool mIsNeedRefreshPlan = false; + private readonly Thread _tdSyncAlreadyFromMiddleDb; + private readonly Thread _tdSyncLocalToMiddleDb; + private readonly Thread _tcCheckNetStatus; + private readonly Thread _tcCheckSyncStatus; - BindingList mWeightRecords; public SegmentationWeightForm() { InitializeComponent(); @@ -49,17 +55,122 @@ namespace SegmentationWeight this.FormClosing += delegate { if (_inQueryThread != null && _inQueryThread.IsAlive) + { DisableWeight(); - // if (syncWork != null && syncWork.IsAlive) - // syncWork.Abort(); - // if (syncToServer != null && syncToServer.IsAlive) - // syncToServer.Abort(); + } + if (_tdSyncLocalToMiddleDb != null && _tdSyncLocalToMiddleDb.IsAlive) + { + _tdSyncLocalToMiddleDb.Abort(); + } + if (_tdSyncAlreadyFromMiddleDb != null && _tdSyncAlreadyFromMiddleDb.IsAlive) + { + _tdSyncAlreadyFromMiddleDb.Abort(); + } + if (_tcCheckNetStatus != null && _tcCheckNetStatus.IsAlive) + { + _tcCheckNetStatus.Abort(); + } + if (_tcCheckSyncStatus != null && _tcCheckSyncStatus.IsAlive) + { + _tcCheckSyncStatus.Abort(); + } }; InitCombox(); InitPlanGoodsNumber(); + + _tdSyncAlreadyFromMiddleDb = new Thread(SyncAlreadyFromMiddleDb); + _tdSyncAlreadyFromMiddleDb.Start(); + + _tdSyncLocalToMiddleDb = new Thread(SyncLocalToMiddleDb); + _tdSyncLocalToMiddleDb.Start(); + + _tcCheckNetStatus = new Thread(CheckNetStatus); + _tcCheckNetStatus.Start(); + + _tcCheckSyncStatus = new Thread(CheckSyncStatus); + _tcCheckSyncStatus.Start(); + } + + private void CheckSyncStatus() + { + while (true) + { + var syncSuccessed = SegmentationWeightRecordRpc.GetInstance().IsSyncSucessed(); + var png = "stop.png"; + if (syncSuccessed) + png = "working.png"; + var imgPath = Path.Combine(Application.StartupPath, "BWP.WinFormControl.dll"); + var s = Assembly.LoadFile(imgPath).GetManifestResourceStream("BWP.WinFormControl.Images." + png); + if (this.InvokeRequired) + { + this.BeginInvoke(new Action(() => + { + picSyncStatus.Image = Image.FromStream(s); + picSyncStatus.Refresh(); + })); + } + else + { + picSyncStatus.Image = Image.FromStream(s); + picSyncStatus.Refresh(); + } + Thread.Sleep(1000); + } + } + + private bool laseConnection = false; + + private void CheckNetStatus() + { + while (true) + { + var newConnection = LoginRpcUtil.TestConnection(500); + if (newConnection && laseConnection) + { + Thread.Sleep(1000); + continue; + } + var png = "stop.png"; + if (newConnection) + png = "working.png"; + var imgPath = Path.Combine(Application.StartupPath, "BWP.WinFormControl.dll"); + var s = Assembly.LoadFile(imgPath).GetManifestResourceStream("BWP.WinFormControl.Images." + png); + if (this.InvokeRequired) + { + this.BeginInvoke(new Action(() => + { + picNetStatus.Image = Image.FromStream(s); + picNetStatus.Refresh(); + })); + } + else + { + picNetStatus.Image = Image.FromStream(s); + picNetStatus.Refresh(); + } + laseConnection = newConnection; + Thread.Sleep(1000); + } + } + + private void SyncLocalToMiddleDb() + { + while (true) + { + if (laseConnection) + { + this.BeginInvoke(new Action(() => + { + SegmentationWeightRecordRpc.GetInstance().SyncToServer(); + })); + + } + Thread.Sleep(1000); + } } + private void cbxBatch_SelectedIndexChanged(object sender, EventArgs e) { InitPlanGoodsNumber(); @@ -67,11 +178,11 @@ namespace SegmentationWeight private void InitPlanGoodsNumber() { - if (LoginRpcUtil.TestConnection(1000)) + if (laseConnection) { var json = RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BillRpc/ProductTaskRpc/GetListByBatch", cbxBatch.Text); mProductTasks = JsonConvert.DeserializeObject>(json); - XmlUtil.SerializerObjToFile(mProductTasks,mProductTasksFileName); + XmlUtil.SerializerObjToFile(mProductTasks, mProductTasksFileName); } else { @@ -113,12 +224,12 @@ namespace SegmentationWeight cbxBatch.DisplayMember = "Name"; cbxBatch.ValueMember = "ID"; } - + } private DropDownSets GetmDropDownSets() { - var sets=new DropDownSets(); + var sets = new DropDownSets(); var wrokUnitSet = GetWrokUnitSet(); var wrokShopSet = GetWrokShopSet(); var productBatchSet = GetProductBatchSet(); @@ -152,7 +263,7 @@ namespace SegmentationWeight return set; } - private DropDownSet GetWrokUnitSet() + private DropDownSet GetWrokUnitSet() { var json = RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BaseInfoRpc/GetWorkUnitList"); var set = new DropDownSet(); @@ -257,9 +368,9 @@ namespace SegmentationWeight lblChengZhong.Text = string.Format(format, decimal.Parse(str)); if (str != "0") { - + //doInsertUnSubmit("", decimal.Parse(lblChengZhong.Text)); - //todo 这里不需要逻辑 点击存货的时候判断是否在误差范围内 + //todo 这里不需要逻辑 的时候判断是否在误差范围内 } })); } @@ -283,7 +394,7 @@ namespace SegmentationWeight if (str != "0") { //doInsertUnSubmit("", decimal.Parse(string.Format(format, num))); - //todo 这里不需要逻辑 点击存货的时候判断是否在误差范围内 + //todo 这里不需要逻辑 的时候判断是否在误差范围内 } })); } @@ -373,7 +484,7 @@ namespace SegmentationWeight private void btnGoodsSet_Click(object sender, EventArgs e) { - var f=new SegmentationWeightGoodsSetForm(); + var f = new SegmentationWeightGoodsSetForm(); if (f.ShowDialog() == DialogResult.OK) { InitControl(); @@ -382,12 +493,10 @@ namespace SegmentationWeight private void SegmentationWeightForm_Load(object sender, EventArgs e) { - mWeightRecords=new BindingList();//以后可能取数据库中没做完的,比如做着做着突然断点 + mWeightRecords = new BindingList();//以后可能取数据库中没做完的,比如做着做着突然断点 RefreshUi(); InitControl(); } - - private void InitControl() { mSetList = XmlUtil.DeserializeFromFile>(SegmentationWeightGoodsSetForm.SegmentationWeightGoodsSetFileName).Where(x => x.IsSelected).ToList(); @@ -395,27 +504,22 @@ namespace SegmentationWeight { return; } - flpClass.Controls.Clear(); - foreach (IGrouping grouping in mSetList.GroupBy(x=>x.Name)) + foreach (IGrouping grouping in mSetList.GroupBy(x => x.Name)) { var btnClass = CreateClassButton(grouping.Key); flpClass.Controls.Add(btnClass); } - } - private Button CreateClassButton(string text) { - var btn=new Button(); + var btn = new Button(); btn.Text = text; btn.Click += Btn_Click; btn.Width = 100; btn.Height = 60; return btn; - } - private void Btn_Click(object sender, EventArgs e) { var text = (sender as Button).Text; @@ -423,26 +527,24 @@ namespace SegmentationWeight { if (cbutton.Text == text) { - cbutton.BackColor=Color.Aqua; + cbutton.BackColor = Color.Aqua; } else { cbutton.BackColor = SystemColors.Control; } } - flpGoods.Controls.Clear(); - foreach (SegmentationWeightGoodSet set in mSetList.Where(x=>x.Name==text)) + foreach (SegmentationWeightGoodSet set in mSetList.Where(x => x.Name == text)) { var btnGoods = CreateGoodsButton(set); flpGoods.Controls.Add(btnGoods); } - } private Button CreateGoodsButton(SegmentationWeightGoodSet set) { - var btn=new Button(); + var btn = new Button(); btn.Text = set.Goods_Name; btn.Tag = set; btn.Click += BtnGoods_Click; @@ -451,13 +553,28 @@ namespace SegmentationWeight return btn; } + //点击存货 private void BtnGoods_Click(object sender, EventArgs e) { var btn = sender as Button; var set = btn.Tag as SegmentationWeightGoodSet; + + if (mWeightRecords.Count > 0) + { + var oldText = mWeightRecords.First().Goods_Name; + if (set.Goods_Name != oldText) + { + MessageBox.Show("跟上次不是同一个存货"); + return; + } + } + + lblGoodsName.Text = set.Goods_Name; + selectGoodsID= set.Goods_ID; + mIsNeedRefreshPlan = true;//todo 这里可以完善 //添加记录 var record = GetRecordBySet(set); - var id=LocalDmoSession.Insert(record); + var id = LocalDmoSession.Insert(record); record.ID = id; mWeightRecords.Add(record); RefreshUi(); @@ -465,6 +582,48 @@ namespace SegmentationWeight SegmentationWeightPrint.Print(entity); } + + + void RefreshUi() + { + + //改成定时任务从数据库中取 + //lblNumber.Text = mWeightRecords.Count.ToString(); + //lblWeight.Text = mWeightRecords.Sum(x => x.Weight).ToString(); + if (mIsNeedRefreshPlan) + { + lblPlanWeight.Text = mProductTasks.Where(x => x.Goods_Name == lblGoodsName.Text).Sum(x => x.Number).ToString(); + lblPlanNumber.Text = mProductTasks.Where(x => x.Goods_Name == lblGoodsName.Text).Sum(x => x.SecondNumber).ToString(); + } + if (mWeightRecords.Count < 1) + { + return; + } + uDataGridView1.DataSource = mWeightRecords; + } + + private long selectGoodsID=0; + private void SyncAlreadyFromMiddleDb() + { + while (true) + { + if (!string.IsNullOrWhiteSpace(lblGoodsName.Text)) + { + if (this.IsHandleCreated) + { + this.BeginInvoke(new Action(() => + { + var res=RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecordRpc/GetCountByNameAndBatch", + selectGoodsID, cbxBatch.Text); + lblNumber.Text = res.Split(',')[0]; + lblWeight.Text = res.Split(',')[1]; + })); + } + } + Thread.Sleep(2000); + } + } + PrintEntity CreatePrintEntity(SegmentationWeightRecord record) { var entity = new PrintEntity(); @@ -472,12 +631,12 @@ namespace SegmentationWeight entity.Goods_Name = record.Goods_Name; entity.Date = DateTime.Today; entity.Checker = "001"; - entity.StoreCondition = "0-4℃"; + entity.StoreCondition = "0-4℃ 4日"; entity.Place = "青岛莱西市珠海路5号"; entity.TelNumber = "0532-88488888"; entity.BarCode = record.BarCode; entity._2DQRCode = string.Format(ButcherAppContext.Context.UrlConfig.OutAddress + "?code=", entity.BarCode); - + entity.Weight = record.Weight.ToString(); return entity; } private SegmentationWeightRecord GetRecordBySet(SegmentationWeightGoodSet set) @@ -487,13 +646,14 @@ namespace SegmentationWeight { throw new Exception("请选择工作单元"); } - var record=new SegmentationWeightRecord(); + var record = new SegmentationWeightRecord(); record.Goods_ID = set.Goods_ID; string liushuihao = GetLiuShuiHao(); - record.BarCode = "A26091201"+DateTime.Today.ToString("yyyyMMdd")+cbxWorkUnit.SelectedValue+ liushuihao; + record.BarCode = "A26091201" + DateTime.Today.ToString("yyyyMMdd") + cbxWorkUnit.SelectedValue + liushuihao; record.Goods_Name = set.Goods_Name; record.Goods_Spec = set.Goods_Spec; record.BiaoShi = cbxWorkUnit.Text; + record.ProductBatch = cbxBatch.Text; var weight = Convert.ToDecimal(lblChengZhong.Text); record.Weight = weight; record.CardBarCode = ""; // @@ -513,18 +673,8 @@ namespace SegmentationWeight return indexCode; } - void RefreshUi() - { - if (mWeightRecords.Count < 1) - { - return; - } - lblGoodsName.Text = mWeightRecords.First().Goods_Name; - lblNumber.Text = mWeightRecords.Count.ToString(); - lblWeight.Text = mWeightRecords.Sum(x => x.Weight).ToString(); - uDataGridView1.DataSource = mWeightRecords; - } + public string RoleName { get { return "分割称重"; } } public Form Generate() @@ -534,10 +684,10 @@ namespace SegmentationWeight private void btnWeightSet_Click(object sender, EventArgs e) { - var form=new WeightSettingFrom(); + var form = new WeightSettingFrom(); form.ShowDialog(); } - + } } diff --git a/SegmentationWeight/SegmentationWeightPrint.cs b/SegmentationWeight/SegmentationWeightPrint.cs index ca8d6f8..4e2bbef 100644 --- a/SegmentationWeight/SegmentationWeightPrint.cs +++ b/SegmentationWeight/SegmentationWeightPrint.cs @@ -16,8 +16,8 @@ namespace SegmentationWeight PrintAPI.B_CreateUSBPort(1); PrintAPI.B_Prn_Text_TrueType(110, 26, 31, "宋体", 1, 700, 0, 0, 0, "C1", entity.AccountingUnit_Name); - PrintAPI.B_Prn_Text_TrueType(42, 70, 31, "宋体", 1, 700, 0, 0, 0, "C2", "合格证"); - PrintAPI.B_Prn_Text_TrueType(440, 70, 31, "宋体", 1, 700, 0, 0, 0, "C3", entity.Goods_Name); + PrintAPI.B_Prn_Text_TrueType(42, 70, 31, "宋体", 1, 400, 0, 0, 0, "C2", string.Format("产品重量:{0}",entity.Weight)); + PrintAPI.B_Prn_Text_TrueType(400, 70, 31, "宋体", 1, 700, 0, 0, 0, "C3", entity.Goods_Name); PrintAPI.B_Prn_Text_TrueType(42, 120, 27, "宋体", 1, 400, 0, 0, 0, "C4", string.Format("生产日期:{0}", entity.Date.ToString("yyyy/MM/dd"))); PrintAPI.B_Prn_Text_TrueType(42, 160, 27, "宋体", 1, 400, 0, 0, 0, "C5", string.Format("检 验 员:{0}", entity.Checker)); @@ -56,5 +56,6 @@ namespace SegmentationWeight public string BarCode { get; set; } public string _2DQRCode { get; set; } + public string Weight { get; set; } } } diff --git a/TrunksIousOutInStore/LocalSyncBO/TrunksIousOutInStoreRecord.cs b/TrunksIousOutInStore/LocalSyncBO/TrunksIousOutInStoreRecord.cs index 6565ff7..74745b8 100644 --- a/TrunksIousOutInStore/LocalSyncBO/TrunksIousOutInStoreRecord.cs +++ b/TrunksIousOutInStore/LocalSyncBO/TrunksIousOutInStoreRecord.cs @@ -1,6 +1,7 @@ using System; using AutoMapper; using BO.BO; +using Forks.EnterpriseServices.DataForm; using Forks.EnterpriseServices.DomainObjects2; using Newtonsoft.Json; using TrunksIousOutInStore.Rpc; @@ -10,6 +11,7 @@ namespace TrunksIousOutInStore.LocalSyncBO [Serializable] [MapToTable("TrunksIousOutInStoreRecord")] + [DFClass] public class TrunksIousOutInStoreRecord: LocalSyncBase { public string BarCode { get; set; } diff --git a/TrunksIousOutInStore/Rpc/TrunksIousOutInStoreRecordDto.cs b/TrunksIousOutInStore/Rpc/TrunksIousOutInStoreRecordDto.cs index 1a9e31e..612fb5c 100644 --- a/TrunksIousOutInStore/Rpc/TrunksIousOutInStoreRecordDto.cs +++ b/TrunksIousOutInStore/Rpc/TrunksIousOutInStoreRecordDto.cs @@ -1,8 +1,10 @@ using BO.BO.Dtos; +using Forks.EnterpriseServices.DataForm; namespace TrunksIousOutInStore.Rpc { - public class TrunksIousOutInStoreRecordDto: SyncBaseDto + [DFClass] + public class TrunksIousOutInStoreRecordDto: SyncBaseDto { public string BarCode { get; set; }