diff --git a/SegmentationInStore/Rpc/Dto/SegmentationInStoreExceptionRecord.cs b/SegmentationInStore/Rpc/Dto/SegmentationInStoreExceptionRecord.cs index 3f16f46..1367de4 100644 --- a/SegmentationInStore/Rpc/Dto/SegmentationInStoreExceptionRecord.cs +++ b/SegmentationInStore/Rpc/Dto/SegmentationInStoreExceptionRecord.cs @@ -35,8 +35,10 @@ namespace SegmentationInStore.Rpc.Dto set { mCreateTime = value; } } + [DbColumn(Length = 1000)] public string BarCode { get; set; } + [DbColumn(Length = 4000)] public string ExceptionStr { get; set; } diff --git a/SegmentationInStore/SegmentationInStoreForm.Designer.cs b/SegmentationInStore/SegmentationInStoreForm.Designer.cs index a7c7bb7..30f095b 100644 --- a/SegmentationInStore/SegmentationInStoreForm.Designer.cs +++ b/SegmentationInStore/SegmentationInStoreForm.Designer.cs @@ -36,11 +36,11 @@ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = 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 dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = 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 dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); @@ -57,6 +57,9 @@ this.label10 = new System.Windows.Forms.Label(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.button2 = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); this.gridSubmited = new BWP.WinFormControl.UDataGridView(); this.submited序号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.submited条码 = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -64,16 +67,13 @@ this.submited重量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.submited仓库 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.submited日期 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); this.uDataGridView1 = new BWP.WinFormControl.UDataGridView(); - this.button2 = new System.Windows.Forms.Button(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.gridUnScan = new BWP.WinFormControl.UDataGridView(); this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.gridUnScan = new BWP.WinFormControl.UDataGridView(); this.unscan序号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.unscan条码 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.unscan产品 = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -91,10 +91,10 @@ this.splitContainer2.Panel2.SuspendLayout(); this.splitContainer2.SuspendLayout(); this.groupBox3.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.gridSubmited)).BeginInit(); this.groupBox2.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).BeginInit(); this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.gridSubmited)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gridUnScan)).BeginInit(); this.SuspendLayout(); // @@ -160,7 +160,7 @@ // richTextBox1 // this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill; - this.richTextBox1.Enabled = false; + this.richTextBox1.HideSelection = false; this.richTextBox1.Location = new System.Drawing.Point(3, 17); this.richTextBox1.Name = "richTextBox1"; this.richTextBox1.Size = new System.Drawing.Size(325, 74); @@ -201,7 +201,7 @@ this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.button1.Location = new System.Drawing.Point(524, 18); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(89, 46); + this.button1.Size = new System.Drawing.Size(76, 34); this.button1.TabIndex = 2; this.button1.Text = "提交"; this.button1.UseVisualStyleBackColor = true; @@ -237,6 +237,7 @@ // // splitContainer2 // + this.splitContainer2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer2.Location = new System.Drawing.Point(0, 0); this.splitContainer2.Name = "splitContainer2"; @@ -261,11 +262,47 @@ this.groupBox3.Controls.Add(this.gridSubmited); this.groupBox3.Location = new System.Drawing.Point(3, 3); this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(597, 482); + this.groupBox3.Size = new System.Drawing.Size(595, 480); this.groupBox3.TabIndex = 3; this.groupBox3.TabStop = false; this.groupBox3.Text = "已扫码产品"; // + // groupBox2 + // + this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox2.Controls.Add(this.uDataGridView1); + this.groupBox2.Controls.Add(this.button2); + this.groupBox2.Location = new System.Drawing.Point(7, 3); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(479, 181); + this.groupBox2.TabIndex = 1; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "退库"; + // + // button2 + // + this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button2.Location = new System.Drawing.Point(6, 17); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(58, 32); + this.button2.TabIndex = 2; + this.button2.Text = "退货"; + this.button2.UseVisualStyleBackColor = true; + // + // groupBox1 + // + this.groupBox1.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.groupBox1.Controls.Add(this.gridUnScan); + this.groupBox1.Location = new System.Drawing.Point(7, 190); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(482, 293); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "未扫码产品"; + // // gridSubmited // this.gridSubmited.AllowUserToAddRows = false; @@ -302,7 +339,7 @@ this.gridSubmited.RowsDefaultCellStyle = dataGridViewCellStyle5; this.gridSubmited.RowTemplate.Height = 23; this.gridSubmited.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.gridSubmited.Size = new System.Drawing.Size(591, 462); + this.gridSubmited.Size = new System.Drawing.Size(589, 460); this.gridSubmited.TabIndex = 1; // // submited序号 @@ -360,19 +397,6 @@ this.submited日期.ReadOnly = true; this.submited日期.Visible = false; // - // groupBox2 - // - this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox2.Controls.Add(this.uDataGridView1); - this.groupBox2.Controls.Add(this.button2); - this.groupBox2.Location = new System.Drawing.Point(7, 3); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(481, 181); - this.groupBox2.TabIndex = 1; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "退库"; - // // uDataGridView1 // this.uDataGridView1.AllowUserToAddRows = false; @@ -409,70 +433,9 @@ this.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle10; this.uDataGridView1.RowTemplate.Height = 23; this.uDataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.uDataGridView1.Size = new System.Drawing.Size(478, 126); + this.uDataGridView1.Size = new System.Drawing.Size(476, 126); this.uDataGridView1.TabIndex = 3; // - // button2 - // - this.button2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.button2.Location = new System.Drawing.Point(6, 17); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(58, 32); - this.button2.TabIndex = 2; - this.button2.Text = "退货"; - this.button2.UseVisualStyleBackColor = true; - // - // groupBox1 - // - this.groupBox1.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.groupBox1.Controls.Add(this.gridUnScan); - this.groupBox1.Location = new System.Drawing.Point(7, 190); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(484, 295); - this.groupBox1.TabIndex = 0; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "未扫码产品"; - // - // gridUnScan - // - this.gridUnScan.AllowUserToAddRows = false; - this.gridUnScan.AllowUserToDeleteRows = false; - this.gridUnScan.AllowUserToResizeColumns = false; - this.gridUnScan.AllowUserToResizeRows = false; - dataGridViewCellStyle11.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.gridUnScan.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11; - this.gridUnScan.BackgroundColor = System.Drawing.Color.White; - dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle12.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.gridUnScan.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12; - this.gridUnScan.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.gridUnScan.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.unscan序号, - this.unscan条码, - this.unscan产品, - this.unscan重量, - this.unscan日期}); - this.gridUnScan.Dock = System.Windows.Forms.DockStyle.Fill; - this.gridUnScan.Location = new System.Drawing.Point(3, 17); - this.gridUnScan.MultiSelect = false; - this.gridUnScan.Name = "gridUnScan"; - this.gridUnScan.ReadOnly = true; - this.gridUnScan.RowHeadersVisible = false; - dataGridViewCellStyle15.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.gridUnScan.RowsDefaultCellStyle = dataGridViewCellStyle15; - this.gridUnScan.RowTemplate.Height = 23; - this.gridUnScan.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.gridUnScan.Size = new System.Drawing.Size(478, 275); - this.gridUnScan.TabIndex = 0; - // // dataGridViewTextBoxColumn1 // this.dataGridViewTextBoxColumn1.DataPropertyName = "ID"; @@ -518,6 +481,44 @@ this.dataGridViewTextBoxColumn5.ReadOnly = true; this.dataGridViewTextBoxColumn5.Visible = false; // + // gridUnScan + // + this.gridUnScan.AllowUserToAddRows = false; + this.gridUnScan.AllowUserToDeleteRows = false; + this.gridUnScan.AllowUserToResizeColumns = false; + this.gridUnScan.AllowUserToResizeRows = false; + dataGridViewCellStyle11.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.gridUnScan.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11; + this.gridUnScan.BackgroundColor = System.Drawing.Color.White; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle12.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gridUnScan.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12; + this.gridUnScan.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.gridUnScan.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.unscan序号, + this.unscan条码, + this.unscan产品, + this.unscan重量, + this.unscan日期}); + this.gridUnScan.Dock = System.Windows.Forms.DockStyle.Fill; + this.gridUnScan.Location = new System.Drawing.Point(3, 17); + this.gridUnScan.MultiSelect = false; + this.gridUnScan.Name = "gridUnScan"; + this.gridUnScan.ReadOnly = true; + this.gridUnScan.RowHeadersVisible = false; + dataGridViewCellStyle15.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.gridUnScan.RowsDefaultCellStyle = dataGridViewCellStyle15; + this.gridUnScan.RowTemplate.Height = 23; + this.gridUnScan.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.gridUnScan.Size = new System.Drawing.Size(476, 273); + this.gridUnScan.TabIndex = 0; + // // unscan序号 // this.unscan序号.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; @@ -593,10 +594,10 @@ ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); this.splitContainer2.ResumeLayout(false); this.groupBox3.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.gridSubmited)).EndInit(); this.groupBox2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).EndInit(); this.groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.gridSubmited)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gridUnScan)).EndInit(); this.ResumeLayout(false); diff --git a/SegmentationInStore/SegmentationInStoreForm.cs b/SegmentationInStore/SegmentationInStoreForm.cs index e006390..d8cacf6 100644 --- a/SegmentationInStore/SegmentationInStoreForm.cs +++ b/SegmentationInStore/SegmentationInStoreForm.cs @@ -422,7 +422,7 @@ namespace SegmentationInStore }; bg.RunWorkerCompleted += delegate { - if (record.ID > 0) + if (record!=null&&record.ID > 0) { mRecordList.Insert(0, record); RefreshRecordUi(); @@ -480,12 +480,14 @@ namespace SegmentationInStore { lock (_insertObj) { + bool haserror = false; + var record = new SegmentationInStoreRecord(); var isExist = IsExist(code); if (isExist) { AddException(code, "重复扫码"); - return record; + haserror = true; } else { @@ -497,27 +499,44 @@ namespace SegmentationInStore try { var weightStr = RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc/GetWeightRecord", code); - var weight = JsonConvert.DeserializeObject(weightStr); - record.Goods_ID = weight.Goods_ID; - record.Goods_Name = weight.Goods_Name; - record.Goods_Spec = weight.Goods_Spec; - record.Weight = weight.Weight; - record.ProductBatch = weight.ProductBatch; - record.BiaoShi = weight.BiaoShi; - record.CardBarCode = weight.CardBarCode; + if (string.IsNullOrWhiteSpace(weightStr)) + { + AddException(code, "无效条码"); + haserror = true; + } + else + { + var weight = JsonConvert.DeserializeObject(weightStr); + record.Goods_ID = weight.Goods_ID; + record.Goods_Name = weight.Goods_Name; + record.Goods_Spec = weight.Goods_Spec; + record.Weight = weight.Weight; + record.ProductBatch = weight.ProductBatch; + record.BiaoShi = weight.BiaoShi; + record.CardBarCode = weight.CardBarCode; + } } catch (Exception e) { AddException(code, e.Message); + haserror = true; } } else { record.Goods_ID = long.Parse(goodsId); } + } + + if (!haserror) + { var id = LocalDmoSession.Insert(record); return record; } + else + { + return null; + } } }