Browse Source

电子秤数据读取修改

callm 4 years ago
parent
commit
d11070d348

+ 5 - 3
UAS_MES_PW/FunctionCode/Make/Make_ColorBoxWeigh.cs

@@ -358,9 +358,11 @@ namespace UAS_MES_NEW.Make
                     byteTemp[0] = Convert.ToByte("00", 16);
                     byteTemp[0] = Convert.ToByte("00", 16);
                     for (int i = 0; i < 10; i++)
                     for (int i = 0; i < 10; i++)
                     {
                     {
-                        if (data[i].ToString() == "0")
-                            continue;
-                        arr.Add(data[i]);
+                        if (i >= 4) {
+                            if (data[i].ToString() == "0")
+                                continue;
+                            arr.Add(data[i]);
+                        }
                     }
                     }
                     for (int i = 0; i < arr.Count; i++)
                     for (int i = 0; i < arr.Count; i++)
                     {
                     {

+ 69 - 28
UAS_MES_PW/FunctionCode/Special/Special_AfterSaleIn.Designer.cs

@@ -43,15 +43,18 @@
             this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.afr_barcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.afr_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.afr_cucode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.barcode = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.barcode = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.pr_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.pr_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.cu_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.cu_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.Clean = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             this.Clean = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             this.OperateResult = new UAS_MES_NEW.CustomControl.RichText.RichTextAutoBottom();
             this.OperateResult = new UAS_MES_NEW.CustomControl.RichText.RichTextAutoBottom();
             this.Confirm = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             this.Confirm = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
+            this.inqty = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.label3 = new System.Windows.Forms.Label();
+            this.afr_barcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.afr_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.afr_cucode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.afr_inqty = new System.Windows.Forms.DataGridViewTextBoxColumn();
             ((System.ComponentModel.ISupportInitialize)(this.Info)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.Info)).BeginInit();
             this.SuspendLayout();
             this.SuspendLayout();
             // 
             // 
@@ -95,7 +98,8 @@
             this.Info.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.Info.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.afr_barcode,
             this.afr_barcode,
             this.afr_prodcode,
             this.afr_prodcode,
-            this.afr_cucode});
+            this.afr_cucode,
+            this.afr_inqty});
             this.Info.Location = new System.Drawing.Point(39, 127);
             this.Info.Location = new System.Drawing.Point(39, 127);
             this.Info.Name = "Info";
             this.Info.Name = "Info";
             this.Info.RowTemplate.Height = 37;
             this.Info.RowTemplate.Height = 37;
@@ -147,7 +151,7 @@
             // Cancel
             // Cancel
             // 
             // 
             this.Cancel.AutoSize = true;
             this.Cancel.AutoSize = true;
-            this.Cancel.Location = new System.Drawing.Point(647, 734);
+            this.Cancel.Location = new System.Drawing.Point(916, 739);
             this.Cancel.Name = "Cancel";
             this.Cancel.Name = "Cancel";
             this.Cancel.Size = new System.Drawing.Size(138, 28);
             this.Cancel.Size = new System.Drawing.Size(138, 28);
             this.Cancel.TabIndex = 223;
             this.Cancel.TabIndex = 223;
@@ -191,30 +195,12 @@
             this.dataGridViewTextBoxColumn3.HeaderText = "客户名称";
             this.dataGridViewTextBoxColumn3.HeaderText = "客户名称";
             this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
             this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
             // 
             // 
-            // afr_barcode
-            // 
-            this.afr_barcode.DataPropertyName = "afr_barcode";
-            this.afr_barcode.HeaderText = "条码号";
-            this.afr_barcode.Name = "afr_barcode";
-            // 
-            // afr_prodcode
-            // 
-            this.afr_prodcode.DataPropertyName = "afr_prodcode";
-            this.afr_prodcode.HeaderText = "物料编号";
-            this.afr_prodcode.Name = "afr_prodcode";
-            // 
-            // afr_cucode
-            // 
-            this.afr_cucode.DataPropertyName = "afr_cucode";
-            this.afr_cucode.HeaderText = "客户名称";
-            this.afr_cucode.Name = "afr_cucode";
-            // 
             // barcode
             // barcode
             // 
             // 
             this.barcode.AllPower = null;
             this.barcode.AllPower = null;
             this.barcode.BackColor = System.Drawing.Color.White;
             this.barcode.BackColor = System.Drawing.Color.White;
             this.barcode.ID = null;
             this.barcode.ID = null;
-            this.barcode.Location = new System.Drawing.Point(190, 732);
+            this.barcode.Location = new System.Drawing.Point(166, 732);
             this.barcode.Margin = new System.Windows.Forms.Padding(4);
             this.barcode.Margin = new System.Windows.Forms.Padding(4);
             this.barcode.Name = "barcode";
             this.barcode.Name = "barcode";
             this.barcode.Power = null;
             this.barcode.Power = null;
@@ -301,7 +287,7 @@
             this.Confirm.DownImage = ((System.Drawing.Image)(resources.GetObject("Confirm.DownImage")));
             this.Confirm.DownImage = ((System.Drawing.Image)(resources.GetObject("Confirm.DownImage")));
             this.Confirm.Image = ((System.Drawing.Image)(resources.GetObject("Confirm.Image")));
             this.Confirm.Image = ((System.Drawing.Image)(resources.GetObject("Confirm.Image")));
             this.Confirm.IsShowBorder = true;
             this.Confirm.IsShowBorder = true;
-            this.Confirm.Location = new System.Drawing.Point(494, 722);
+            this.Confirm.Location = new System.Drawing.Point(470, 722);
             this.Confirm.Margin = new System.Windows.Forms.Padding(8);
             this.Confirm.Margin = new System.Windows.Forms.Padding(8);
             this.Confirm.MoveImage = ((System.Drawing.Image)(resources.GetObject("Confirm.MoveImage")));
             this.Confirm.MoveImage = ((System.Drawing.Image)(resources.GetObject("Confirm.MoveImage")));
             this.Confirm.Name = "Confirm";
             this.Confirm.Name = "Confirm";
@@ -313,11 +299,63 @@
             this.Confirm.UseVisualStyleBackColor = true;
             this.Confirm.UseVisualStyleBackColor = true;
             this.Confirm.Click += new System.EventHandler(this.Confirm_Click);
             this.Confirm.Click += new System.EventHandler(this.Confirm_Click);
             // 
             // 
+            // inqty
+            // 
+            this.inqty.AllPower = null;
+            this.inqty.BackColor = System.Drawing.Color.White;
+            this.inqty.ID = null;
+            this.inqty.Location = new System.Drawing.Point(751, 732);
+            this.inqty.Margin = new System.Windows.Forms.Padding(4);
+            this.inqty.Name = "inqty";
+            this.inqty.Power = null;
+            this.inqty.Size = new System.Drawing.Size(111, 35);
+            this.inqty.Str = null;
+            this.inqty.Str1 = null;
+            this.inqty.Str2 = null;
+            this.inqty.TabIndex = 226;
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label3.Location = new System.Drawing.Point(595, 726);
+            this.label3.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(146, 41);
+            this.label3.TabIndex = 227;
+            this.label3.Text = "入库数量";
+            // 
+            // afr_barcode
+            // 
+            this.afr_barcode.DataPropertyName = "afr_barcode";
+            this.afr_barcode.HeaderText = "条码号";
+            this.afr_barcode.Name = "afr_barcode";
+            // 
+            // afr_prodcode
+            // 
+            this.afr_prodcode.DataPropertyName = "afr_prodcode";
+            this.afr_prodcode.HeaderText = "物料编号";
+            this.afr_prodcode.Name = "afr_prodcode";
+            // 
+            // afr_cucode
+            // 
+            this.afr_cucode.DataPropertyName = "afr_cucode";
+            this.afr_cucode.HeaderText = "客户名称";
+            this.afr_cucode.Name = "afr_cucode";
+            // 
+            // afr_inqty
+            // 
+            this.afr_inqty.DataPropertyName = "afr_inqty";
+            this.afr_inqty.HeaderText = "入库数量";
+            this.afr_inqty.Name = "afr_inqty";
+            // 
             // Special_AfterSaleIn
             // Special_AfterSaleIn
             // 
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1566, 802);
             this.ClientSize = new System.Drawing.Size(1566, 802);
+            this.Controls.Add(this.label3);
+            this.Controls.Add(this.inqty);
             this.Controls.Add(this.label2);
             this.Controls.Add(this.label2);
             this.Controls.Add(this.InDate);
             this.Controls.Add(this.InDate);
             this.Controls.Add(this.Cancel);
             this.Controls.Add(this.Cancel);
@@ -359,9 +397,6 @@
         private CustomControl.TextBoxWithIcon.EnterTextBox barcode;
         private CustomControl.TextBoxWithIcon.EnterTextBox barcode;
         private System.Windows.Forms.Label label1;
         private System.Windows.Forms.Label label1;
         private System.Windows.Forms.DataGridView Info;
         private System.Windows.Forms.DataGridView Info;
-        private System.Windows.Forms.DataGridViewTextBoxColumn afr_barcode;
-        private System.Windows.Forms.DataGridViewTextBoxColumn afr_prodcode;
-        private System.Windows.Forms.DataGridViewTextBoxColumn afr_cucode;
         private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
         private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
         private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
         private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
         private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
         private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
@@ -372,5 +407,11 @@
         private System.Windows.Forms.CheckBox Cancel;
         private System.Windows.Forms.CheckBox Cancel;
         private System.Windows.Forms.DateTimePicker InDate;
         private System.Windows.Forms.DateTimePicker InDate;
         private System.Windows.Forms.Label label2;
         private System.Windows.Forms.Label label2;
+        private CustomControl.TextBoxWithIcon.EnterTextBox inqty;
+        private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.DataGridViewTextBoxColumn afr_barcode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn afr_prodcode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn afr_cucode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn afr_inqty;
     }
     }
 }
 }

+ 11 - 3
UAS_MES_PW/FunctionCode/Special/Special_AfterSaleIn.cs

@@ -41,6 +41,12 @@ namespace UAS_MES_NEW.Special
 
 
         private void Confirm_Click(object sender, EventArgs e)
         private void Confirm_Click(object sender, EventArgs e)
         {
         {
+            int in_qty = 0;
+            if (!int.TryParse(inqty.Text, out in_qty))
+            {
+                OperateResult.AppendText(">>入库数错误\n", Color.Red, barcode);
+                return;
+            }
             //正常录入资料的时候
             //正常录入资料的时候
             if (!Cancel.Checked)
             if (!Cancel.Checked)
             {
             {
@@ -60,9 +66,10 @@ namespace UAS_MES_NEW.Special
                     return;
                     return;
                 }
                 }
                 sql.Clear();
                 sql.Clear();
-                sql.Append("insert into aftersalerecord(afr_id,afr_barcode,afr_prodcode,afr_cucode,afr_indate)");
-                sql.Append("values(aftersalerecord_seq.nextval,'" + barcode.Text + "','" + pr_code.Text + "','" + cu_code.Text + "',sysdate)");
+                sql.Append("insert into aftersalerecord(afr_id,afr_barcode,afr_prodcode,afr_cucode,afr_indate,afr_inqty)");
+                sql.Append("values(aftersalerecord_seq.nextval,'" + barcode.Text + "','" + pr_code.Text + "','" + cu_code.Text + "',sysdate," + inqty.Text + ")");
                 dh.ExecuteSql(sql.GetString(), "insert");
                 dh.ExecuteSql(sql.GetString(), "insert");
+                dh.ExecuteSql("insert into aftersalerecordlog(afl_id,afl_barcode,afl_prodcode,afl_qty,afl_type) select aftersalerecordlog_seq.nextval,afr_barcode,afr_prodcode," + inqty.Text + ",'入库' from aftersalerecord where afr_barcode='" + barcode.Text + "'", "insert");
                 OperateResult.AppendText(">>条码" + barcode.Text + "录入成功\n", Color.Green, barcode);
                 OperateResult.AppendText(">>条码" + barcode.Text + "录入成功\n", Color.Green, barcode);
                 LoadGridData();
                 LoadGridData();
             }
             }
@@ -73,7 +80,7 @@ namespace UAS_MES_NEW.Special
                     OperateResult.AppendText(">>条码" + barcode.Text + "不存在\n", Color.Red, barcode);
                     OperateResult.AppendText(">>条码" + barcode.Text + "不存在\n", Color.Red, barcode);
                     return;
                     return;
                 }
                 }
-                if (dh.CheckExist("aftersalerecord", "afr_barcode='" + barcode.Text + "' and afr_outdate is not null"))
+                if (dh.CheckExist("aftersalerecord", "afr_barcode='" + barcode.Text + "' and nvl(afr_outqty,0) =0"))
                 {
                 {
                     OperateResult.AppendText(">>条码" + barcode.Text + "已出库\n", Color.Red, barcode);
                     OperateResult.AppendText(">>条码" + barcode.Text + "已出库\n", Color.Red, barcode);
                     return;
                     return;
@@ -81,6 +88,7 @@ namespace UAS_MES_NEW.Special
                 sql.Clear();
                 sql.Clear();
                 sql.Append("delete from aftersalerecord where afr_barcode='" + barcode.Text + "'");
                 sql.Append("delete from aftersalerecord where afr_barcode='" + barcode.Text + "'");
                 dh.ExecuteSql(sql.GetString(), "delete");
                 dh.ExecuteSql(sql.GetString(), "delete");
+                dh.ExecuteSql("insert into aftersalerecordlog(afl_id,afl_barcode,afl_prodcode,afl_qty,afl_type) select aftersalerecordlog_seq.nextval,afr_barcode,afr_prodcode," + inqty.Text + ",'取消入库' from aftersalerecord where afr_barcode='" + barcode.Text + "'", "insert");
                 OperateResult.AppendText(">>条码" + barcode.Text + "取消成功\n", Color.Green, barcode);
                 OperateResult.AppendText(">>条码" + barcode.Text + "取消成功\n", Color.Green, barcode);
                 LoadGridData();
                 LoadGridData();
             }
             }

+ 1 - 7
UAS_MES_PW/FunctionCode/Special/Special_AfterSaleIn.resx

@@ -126,13 +126,7 @@
   <metadata name="afr_cucode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
   <metadata name="afr_cucode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
     <value>True</value>
   </metadata>
   </metadata>
-  <metadata name="afr_barcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="afr_prodcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="afr_cucode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="afr_inqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
     <value>True</value>
   </metadata>
   </metadata>
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

+ 68 - 36
UAS_MES_PW/FunctionCode/Special/Special_AfterSaleOut.Designer.cs

@@ -32,6 +32,10 @@
             this.cu_code_label = new System.Windows.Forms.Label();
             this.cu_code_label = new System.Windows.Forms.Label();
             this.label1 = new System.Windows.Forms.Label();
             this.label1 = new System.Windows.Forms.Label();
             this.Info = new System.Windows.Forms.DataGridView();
             this.Info = new System.Windows.Forms.DataGridView();
+            this.afr_barcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.afr_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_detail = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.afr_cucode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.cu_name = new System.Windows.Forms.Label();
             this.cu_name = new System.Windows.Forms.Label();
             this.label5 = new System.Windows.Forms.Label();
             this.label5 = new System.Windows.Forms.Label();
             this.Cancel = new System.Windows.Forms.CheckBox();
             this.Cancel = new System.Windows.Forms.CheckBox();
@@ -41,15 +45,13 @@
             this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.afr_barcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.afr_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pr_detail = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.afr_cucode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.barcode = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.barcode = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.cu_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.cu_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.Clean = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             this.Clean = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             this.OperateResult = new UAS_MES_NEW.CustomControl.RichText.RichTextAutoBottom();
             this.OperateResult = new UAS_MES_NEW.CustomControl.RichText.RichTextAutoBottom();
             this.Confirm = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             this.Confirm = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
+            this.label3 = new System.Windows.Forms.Label();
+            this.outqty = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
             ((System.ComponentModel.ISupportInitialize)(this.Info)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.Info)).BeginInit();
             this.SuspendLayout();
             this.SuspendLayout();
             // 
             // 
@@ -90,6 +92,35 @@
             this.Info.Size = new System.Drawing.Size(1072, 608);
             this.Info.Size = new System.Drawing.Size(1072, 608);
             this.Info.TabIndex = 218;
             this.Info.TabIndex = 218;
             // 
             // 
+            // afr_barcode
+            // 
+            this.afr_barcode.DataPropertyName = "afr_barcode";
+            this.afr_barcode.HeaderText = "条码号";
+            this.afr_barcode.MinimumWidth = 80;
+            this.afr_barcode.Name = "afr_barcode";
+            // 
+            // afr_prodcode
+            // 
+            this.afr_prodcode.DataPropertyName = "afr_prodcode";
+            this.afr_prodcode.HeaderText = "物料编号";
+            this.afr_prodcode.MinimumWidth = 100;
+            this.afr_prodcode.Name = "afr_prodcode";
+            // 
+            // pr_detail
+            // 
+            this.pr_detail.DataPropertyName = "pr_detail";
+            this.pr_detail.HeaderText = "物料名称";
+            this.pr_detail.MinimumWidth = 90;
+            this.pr_detail.Name = "pr_detail";
+            // 
+            // afr_cucode
+            // 
+            this.afr_cucode.DataPropertyName = "pr_spec";
+            this.afr_cucode.HeaderText = "物料规格";
+            this.afr_cucode.MinimumWidth = 300;
+            this.afr_cucode.Name = "afr_cucode";
+            this.afr_cucode.Width = 300;
+            // 
             // cu_name
             // cu_name
             // 
             // 
             this.cu_name.AutoSize = true;
             this.cu_name.AutoSize = true;
@@ -114,7 +145,7 @@
             // Cancel
             // Cancel
             // 
             // 
             this.Cancel.AutoSize = true;
             this.Cancel.AutoSize = true;
-            this.Cancel.Location = new System.Drawing.Point(647, 734);
+            this.Cancel.Location = new System.Drawing.Point(896, 737);
             this.Cancel.Name = "Cancel";
             this.Cancel.Name = "Cancel";
             this.Cancel.Size = new System.Drawing.Size(138, 28);
             this.Cancel.Size = new System.Drawing.Size(138, 28);
             this.Cancel.TabIndex = 223;
             this.Cancel.TabIndex = 223;
@@ -169,41 +200,12 @@
             this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
             this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
             this.dataGridViewTextBoxColumn4.Width = 300;
             this.dataGridViewTextBoxColumn4.Width = 300;
             // 
             // 
-            // afr_barcode
-            // 
-            this.afr_barcode.DataPropertyName = "afr_barcode";
-            this.afr_barcode.HeaderText = "条码号";
-            this.afr_barcode.MinimumWidth = 80;
-            this.afr_barcode.Name = "afr_barcode";
-            // 
-            // afr_prodcode
-            // 
-            this.afr_prodcode.DataPropertyName = "afr_prodcode";
-            this.afr_prodcode.HeaderText = "物料编号";
-            this.afr_prodcode.MinimumWidth = 100;
-            this.afr_prodcode.Name = "afr_prodcode";
-            // 
-            // pr_detail
-            // 
-            this.pr_detail.DataPropertyName = "pr_detail";
-            this.pr_detail.HeaderText = "物料名称";
-            this.pr_detail.MinimumWidth = 90;
-            this.pr_detail.Name = "pr_detail";
-            // 
-            // afr_cucode
-            // 
-            this.afr_cucode.DataPropertyName = "pr_spec";
-            this.afr_cucode.HeaderText = "物料规格";
-            this.afr_cucode.MinimumWidth = 300;
-            this.afr_cucode.Name = "afr_cucode";
-            this.afr_cucode.Width = 300;
-            // 
             // barcode
             // barcode
             // 
             // 
             this.barcode.AllPower = null;
             this.barcode.AllPower = null;
             this.barcode.BackColor = System.Drawing.Color.White;
             this.barcode.BackColor = System.Drawing.Color.White;
             this.barcode.ID = null;
             this.barcode.ID = null;
-            this.barcode.Location = new System.Drawing.Point(190, 732);
+            this.barcode.Location = new System.Drawing.Point(166, 732);
             this.barcode.Margin = new System.Windows.Forms.Padding(4);
             this.barcode.Margin = new System.Windows.Forms.Padding(4);
             this.barcode.Name = "barcode";
             this.barcode.Name = "barcode";
             this.barcode.Power = null;
             this.barcode.Power = null;
@@ -270,7 +272,7 @@
             this.Confirm.DownImage = ((System.Drawing.Image)(resources.GetObject("Confirm.DownImage")));
             this.Confirm.DownImage = ((System.Drawing.Image)(resources.GetObject("Confirm.DownImage")));
             this.Confirm.Image = ((System.Drawing.Image)(resources.GetObject("Confirm.Image")));
             this.Confirm.Image = ((System.Drawing.Image)(resources.GetObject("Confirm.Image")));
             this.Confirm.IsShowBorder = true;
             this.Confirm.IsShowBorder = true;
-            this.Confirm.Location = new System.Drawing.Point(494, 722);
+            this.Confirm.Location = new System.Drawing.Point(470, 722);
             this.Confirm.Margin = new System.Windows.Forms.Padding(8);
             this.Confirm.Margin = new System.Windows.Forms.Padding(8);
             this.Confirm.MoveImage = ((System.Drawing.Image)(resources.GetObject("Confirm.MoveImage")));
             this.Confirm.MoveImage = ((System.Drawing.Image)(resources.GetObject("Confirm.MoveImage")));
             this.Confirm.Name = "Confirm";
             this.Confirm.Name = "Confirm";
@@ -282,11 +284,39 @@
             this.Confirm.UseVisualStyleBackColor = true;
             this.Confirm.UseVisualStyleBackColor = true;
             this.Confirm.Click += new System.EventHandler(this.Confirm_Click);
             this.Confirm.Click += new System.EventHandler(this.Confirm_Click);
             // 
             // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label3.Location = new System.Drawing.Point(604, 729);
+            this.label3.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(146, 41);
+            this.label3.TabIndex = 229;
+            this.label3.Text = "出库数量";
+            // 
+            // outqty
+            // 
+            this.outqty.AllPower = null;
+            this.outqty.BackColor = System.Drawing.Color.White;
+            this.outqty.ID = null;
+            this.outqty.Location = new System.Drawing.Point(760, 735);
+            this.outqty.Margin = new System.Windows.Forms.Padding(4);
+            this.outqty.Name = "outqty";
+            this.outqty.Power = null;
+            this.outqty.Size = new System.Drawing.Size(111, 35);
+            this.outqty.Str = null;
+            this.outqty.Str1 = null;
+            this.outqty.Str2 = null;
+            this.outqty.TabIndex = 228;
+            // 
             // Special_AfterSaleOut
             // Special_AfterSaleOut
             // 
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1566, 802);
             this.ClientSize = new System.Drawing.Size(1566, 802);
+            this.Controls.Add(this.label3);
+            this.Controls.Add(this.outqty);
             this.Controls.Add(this.label2);
             this.Controls.Add(this.label2);
             this.Controls.Add(this.InDate);
             this.Controls.Add(this.InDate);
             this.Controls.Add(this.Cancel);
             this.Controls.Add(this.Cancel);
@@ -335,5 +365,7 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn afr_prodcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn afr_prodcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_detail;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_detail;
         private System.Windows.Forms.DataGridViewTextBoxColumn afr_cucode;
         private System.Windows.Forms.DataGridViewTextBoxColumn afr_cucode;
+        private System.Windows.Forms.Label label3;
+        private CustomControl.TextBoxWithIcon.EnterTextBox outqty;
     }
     }
 }
 }

+ 15 - 7
UAS_MES_PW/FunctionCode/Special/Special_AfterSaleOut.cs

@@ -36,6 +36,12 @@ namespace UAS_MES_NEW.Special
 
 
         private void Confirm_Click(object sender, EventArgs e)
         private void Confirm_Click(object sender, EventArgs e)
         {
         {
+            int out_qty = 0;
+            if (!int.TryParse(outqty.Text, out out_qty))
+            {
+                OperateResult.AppendText(">>出库数错误\n", Color.Red, barcode);
+                return;
+            }
             //正常录入资料的时候
             //正常录入资料的时候
             if (!Cancel.Checked)
             if (!Cancel.Checked)
             {
             {
@@ -44,12 +50,12 @@ namespace UAS_MES_NEW.Special
                     OperateResult.AppendText(">>客户编号不能为空\n", Color.Red, barcode);
                     OperateResult.AppendText(">>客户编号不能为空\n", Color.Red, barcode);
                     return;
                     return;
                 }
                 }
-                if (!dh.CheckExist("aftersalerecord", "afr_barcode='" + barcode.Text + "'"))
+                if (!dh.CheckExist("aftersalerecord", "afr_barcode='" + barcode.Text + "' and  nvl(afr_outqty,0)+" + outqty.Text + "<=afr_inqty"))
                 {
                 {
-                    OperateResult.AppendText(">>条码" + barcode.Text + "不存在\n", Color.Red, barcode);
+                    OperateResult.AppendText(">>条码" + barcode.Text + "不存在或出库数量不足\n", Color.Red, barcode);
                     return;
                     return;
                 }
                 }
-                if (!dh.CheckExist("aftersalerecord", "afr_barcode='" + barcode.Text + "' and afr_outdate is null"))
+                if (dh.CheckExist("aftersalerecord", "afr_barcode='" + barcode.Text + "' and afr_outqty>=afr_inqty"))
                 {
                 {
                     OperateResult.AppendText(">>条码" + barcode.Text + "已出库\n", Color.Red, barcode);
                     OperateResult.AppendText(">>条码" + barcode.Text + "已出库\n", Color.Red, barcode);
                     return;
                     return;
@@ -60,8 +66,9 @@ namespace UAS_MES_NEW.Special
                     return;
                     return;
                 }
                 }
                 sql.Clear();
                 sql.Clear();
-                sql.Append("update aftersalerecord set afr_outdate=sysdate,afr_outcucode='" + cu_code.Text + "' where afr_barcode='" + barcode.Text + "'");
+                sql.Append("update aftersalerecord set afr_outdate=sysdate,afr_outcucode='" + cu_code.Text + "',afr_outqty=nvl(afr_outqty,0)+" + outqty.Text + " where afr_barcode='" + barcode.Text + "'");
                 dh.ExecuteSql(sql.GetString(), "update");
                 dh.ExecuteSql(sql.GetString(), "update");
+                dh.ExecuteSql("insert into aftersalerecordlog(afl_id,afl_barcode,afl_prodcode,afl_qty,afl_type) select aftersalerecordlog_seq.nextval,afr_barcode,afr_prodcode," + outqty.Text + ",'出库' from aftersalerecord where afr_barcode='" + barcode.Text + "'", "insert");
                 OperateResult.AppendText(">>条码" + barcode.Text + "出库成功\n", Color.Green, barcode);
                 OperateResult.AppendText(">>条码" + barcode.Text + "出库成功\n", Color.Green, barcode);
                 LoadGridData();
                 LoadGridData();
             }
             }
@@ -72,13 +79,14 @@ namespace UAS_MES_NEW.Special
                     OperateResult.AppendText(">>条码" + barcode.Text + "不存在\n", Color.Red, barcode);
                     OperateResult.AppendText(">>条码" + barcode.Text + "不存在\n", Color.Red, barcode);
                     return;
                     return;
                 }
                 }
-                if (dh.CheckExist("aftersalerecord", "afr_barcode='" + barcode.Text + "' and afr_outdate is null"))
+                if (dh.CheckExist("aftersalerecord", "afr_barcode='" + barcode.Text + "' and   nvl(afr_outqty,0)-" + outqty.Text + "<0"))
                 {
                 {
-                    OperateResult.AppendText(">>条码" + barcode.Text + "未出库\n", Color.Red, barcode);
+                    OperateResult.AppendText(">>条码" + barcode.Text + "取消出库数量不足\n", Color.Red, barcode);
                     return;
                     return;
                 }
                 }
                 sql.Clear();
                 sql.Clear();
-                sql.Append("update aftersalerecord set afr_outdate=null,afr_outcucode=null where afr_barcode='" + barcode.Text + "'");
+                sql.Append("update aftersalerecord set afr_outdate=null,afr_outcucode=null,afr_outqty=nvl(afr_outqty,0)-" + outqty.Text + " where afr_barcode='" + barcode.Text + "'");
+                dh.ExecuteSql("insert into aftersalerecordlog(afl_id,afl_barcode,afl_prodcode,afl_qty,afl_type) select aftersalerecordlog_seq.nextval,afr_barcode,afr_prodcode," + outqty.Text + ",'取消出库' from aftersalerecord where afr_barcode='" + barcode.Text + "'", "insert");
                 dh.ExecuteSql(sql.GetString(), "update");
                 dh.ExecuteSql(sql.GetString(), "update");
                 OperateResult.AppendText(">>条码" + barcode.Text + "取消出库成功\n", Color.Green, barcode);
                 OperateResult.AppendText(">>条码" + barcode.Text + "取消出库成功\n", Color.Green, barcode);
                 LoadGridData();
                 LoadGridData();