shim %!s(int64=8) %!d(string=hai) anos
pai
achega
63eb014f2a

+ 17 - 17
UAS-MES/FunctionCode/Packing/Packing_ProdWeightSet.Designer.cs

@@ -73,7 +73,7 @@
             // 
             this.pr_code.AutoSize = true;
             this.pr_code.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.pr_code.Location = new System.Drawing.Point(160, 121);
+            this.pr_code.Location = new System.Drawing.Point(160, 74);
             this.pr_code.Name = "pr_code";
             this.pr_code.Size = new System.Drawing.Size(0, 31);
             this.pr_code.TabIndex = 215;
@@ -82,7 +82,7 @@
             // 
             this.label2.AutoSize = true;
             this.label2.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.label2.Location = new System.Drawing.Point(33, 121);
+            this.label2.Location = new System.Drawing.Point(33, 74);
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(110, 31);
             this.label2.TabIndex = 214;
@@ -92,7 +92,7 @@
             // 
             this.pr_detail.AutoSize = true;
             this.pr_detail.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.pr_detail.Location = new System.Drawing.Point(160, 175);
+            this.pr_detail.Location = new System.Drawing.Point(160, 128);
             this.pr_detail.Name = "pr_detail";
             this.pr_detail.Size = new System.Drawing.Size(0, 31);
             this.pr_detail.TabIndex = 217;
@@ -101,7 +101,7 @@
             // 
             this.label3.AutoSize = true;
             this.label3.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.label3.Location = new System.Drawing.Point(33, 175);
+            this.label3.Location = new System.Drawing.Point(33, 128);
             this.label3.Name = "label3";
             this.label3.Size = new System.Drawing.Size(110, 31);
             this.label3.TabIndex = 216;
@@ -111,7 +111,7 @@
             // 
             this.pr_spec.AutoSize = true;
             this.pr_spec.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.pr_spec.Location = new System.Drawing.Point(160, 228);
+            this.pr_spec.Location = new System.Drawing.Point(160, 181);
             this.pr_spec.MaximumSize = new System.Drawing.Size(600, 40);
             this.pr_spec.Name = "pr_spec";
             this.pr_spec.Size = new System.Drawing.Size(0, 31);
@@ -121,7 +121,7 @@
             // 
             this.label5.AutoSize = true;
             this.label5.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.label5.Location = new System.Drawing.Point(33, 228);
+            this.label5.Location = new System.Drawing.Point(33, 181);
             this.label5.Name = "label5";
             this.label5.Size = new System.Drawing.Size(62, 31);
             this.label5.TabIndex = 218;
@@ -136,10 +136,10 @@
             this.columnHeader4,
             this.columnHeader5});
             this.showResult.Font = new System.Drawing.Font("宋体", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.showResult.Location = new System.Drawing.Point(412, 272);
+            this.showResult.Location = new System.Drawing.Point(427, 250);
             this.showResult.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.showResult.Name = "showResult";
-            this.showResult.Size = new System.Drawing.Size(654, 309);
+            this.showResult.Size = new System.Drawing.Size(658, 307);
             this.showResult.TabIndex = 220;
             this.showResult.UseCompatibleStateImageBehavior = false;
             this.showResult.View = System.Windows.Forms.View.Details;
@@ -153,7 +153,7 @@
             // 
             this.columnHeader2.Text = "序号";
             this.columnHeader2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            this.columnHeader2.Width = 120;
+            this.columnHeader2.Width = 110;
             // 
             // columnHeader3
             // 
@@ -179,7 +179,7 @@
             this.panel4.Controls.Add(this.pr_cartonunit);
             this.panel4.Controls.Add(this.label22);
             this.panel4.Controls.Add(this.weight);
-            this.panel4.Location = new System.Drawing.Point(540, 18);
+            this.panel4.Location = new System.Drawing.Point(570, 18);
             this.panel4.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
             this.panel4.Name = "panel4";
             this.panel4.Size = new System.Drawing.Size(515, 156);
@@ -229,7 +229,7 @@
             // 
             this.label1.AutoSize = true;
             this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label1.Location = new System.Drawing.Point(33, 72);
+            this.label1.Location = new System.Drawing.Point(15, 526);
             this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label1.Name = "label1";
             this.label1.Size = new System.Drawing.Size(86, 31);
@@ -242,7 +242,7 @@
             this.sncode.BackColor = System.Drawing.Color.White;
             this.sncode.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.sncode.ID = null;
-            this.sncode.Location = new System.Drawing.Point(166, 72);
+            this.sncode.Location = new System.Drawing.Point(109, 526);
             this.sncode.Name = "sncode";
             this.sncode.Power = null;
             this.sncode.Size = new System.Drawing.Size(187, 31);
@@ -259,7 +259,7 @@
             this.confirm.DownImage = ((System.Drawing.Image)(resources.GetObject("confirm.DownImage")));
             this.confirm.Image = null;
             this.confirm.IsShowBorder = true;
-            this.confirm.Location = new System.Drawing.Point(127, 552);
+            this.confirm.Location = new System.Drawing.Point(331, 526);
             this.confirm.MoveImage = ((System.Drawing.Image)(resources.GetObject("confirm.MoveImage")));
             this.confirm.Name = "confirm";
             this.confirm.NormalImage = ((System.Drawing.Image)(resources.GetObject("confirm.NormalImage")));
@@ -273,7 +273,7 @@
             // OperateResult
             // 
             this.OperateResult.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OperateResult.Location = new System.Drawing.Point(21, 272);
+            this.OperateResult.Location = new System.Drawing.Point(21, 248);
             this.OperateResult.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.OperateResult.Name = "OperateResult";
             this.OperateResult.Size = new System.Drawing.Size(333, 254);
@@ -317,7 +317,7 @@
             this.stopWeigh.DownImage = ((System.Drawing.Image)(resources.GetObject("stopWeigh.DownImage")));
             this.stopWeigh.Image = null;
             this.stopWeigh.IsShowBorder = true;
-            this.stopWeigh.Location = new System.Drawing.Point(811, 194);
+            this.stopWeigh.Location = new System.Drawing.Point(808, 187);
             this.stopWeigh.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.stopWeigh.MoveImage = ((System.Drawing.Image)(resources.GetObject("stopWeigh.MoveImage")));
             this.stopWeigh.Name = "stopWeigh";
@@ -336,7 +336,7 @@
             this.startWeigh.DownImage = ((System.Drawing.Image)(resources.GetObject("startWeigh.DownImage")));
             this.startWeigh.Image = null;
             this.startWeigh.IsShowBorder = true;
-            this.startWeigh.Location = new System.Drawing.Point(657, 194);
+            this.startWeigh.Location = new System.Drawing.Point(654, 187);
             this.startWeigh.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.startWeigh.MoveImage = ((System.Drawing.Image)(resources.GetObject("startWeigh.MoveImage")));
             this.startWeigh.Name = "startWeigh";
@@ -374,7 +374,7 @@
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1094, 615);
+            this.ClientSize = new System.Drawing.Size(1121, 595);
             this.Controls.Add(this.label1);
             this.Controls.Add(this.sncode);
             this.Controls.Add(this.confirm);

+ 37 - 7
UAS-MES/FunctionCode/Packing/Packing_ProdWeightSet.cs

@@ -21,6 +21,8 @@ namespace UAS_MES.Packing
 
         AutoSizeFormClass asc = new AutoSizeFormClass();
 
+        LogStringBuilder sql = new LogStringBuilder();
+
         DataTable Dbfind;//存储工单号查询出来的信息
 
         //创建串口实例
@@ -38,6 +40,10 @@ namespace UAS_MES.Packing
         string maxValue = "";//存储最大值
 
         string minValue = "";//存储最小值
+
+        List<string> sncodes = new List<string>();//存序列号
+        List<string> indates = new List<string>();//存时间
+        List<string> weights = new List<string>();//存重量
         public Packing_ProdWeightSet()
         {
             InitializeComponent();
@@ -64,7 +70,7 @@ namespace UAS_MES.Packing
             Dbfind = ma_code.ReturnData;
             BaseUtil.SetFormValue(this.Controls, Dbfind);
         }
-        private void recordResult(int index,string palletcode, string weigh, string time)
+        private void recordResult(int index,string palletcode, string weigh, DateTime time)
         {
             //创建一个item
             ListViewItem lvi = new ListViewItem();
@@ -72,10 +78,13 @@ namespace UAS_MES.Packing
             lvi.SubItems.Add(index+"");
             lvi.SubItems.Add(palletcode);
             lvi.SubItems.Add(weigh+pr_cartonunit.Text);
-            lvi.SubItems.Add(time);
+            lvi.SubItems.Add(time.ToString());
             //添加结果的信息进去
             showResult.Items.Add(lvi);
-
+            //将重量信息加到集合中
+            sncodes.Add(palletcode);
+            indates.Add(time.ToString("YYYY-MM-dd HH:mm:ss"));
+            weights.Add(weigh);
             //更新已称重量最大值最小值
             if (index > 1)
             {
@@ -86,6 +95,10 @@ namespace UAS_MES.Packing
             {
                 maxValue = weigh;
                 minValue = weigh;
+                //每次添加第一条数据的时候清空list的值
+                sncodes.Clear();
+                indates.Clear();
+                weights.Clear();
             }
         }
 
@@ -160,6 +173,12 @@ namespace UAS_MES.Packing
             //更新彩盒重量最大值最小值
             dh.ExecuteSql("update product set PR_COLORBOXMAXW ='"+maxValue+"', PR_COLORBOXMINW = '"+minValue+ "',PR_COLORBOXUNIT='"+pr_cartonunit.Text+"' where pr_code='" + pr_code.Text+"'", "update");
             OperateResult.AppendText("<<重量设置成功,最大值"+maxValue+pr_cartonunit.Text+",最小值"+minValue+pr_cartonunit.Text+"\n", Color.Green);
+            //更新采样记录表
+            string serialNum = dh.GetSerialNumberByCaller("ProdWeightSample");
+            sql.Clear();
+            sql.Append("insert into PRODWEIGHTSAMPLE(PWS_CODE,PWS_SNCODE,PWS_MAKECODE,PWS_PRODCODE,PWS_INDATE,PWS_WEIGHT,PWS_UNIT) ");
+            sql.Append("values ('"+serialNum+"',:sncode,'"+ma_code.Text+"','"+pr_code.Text+ "',TO_Date(:indate,'YYYY-MM-dd HH24:mi:ss'),:weight,'" + pr_cartonunit.Text+"')");
+            dh.BatchInsert(sql.GetString(), new string[] { "sncode", "indate" , "weight" },sncodes.ToArray(),indates.ToArray(),weights.ToArray());
         }
 
         private void sncode_KeyDown(object sender, KeyEventArgs e)
@@ -182,14 +201,20 @@ namespace UAS_MES.Packing
                     OperateResult.AppendText("<<重量不能等于0\n", Color.Red, sncode);
                     return;
                 }
-                //验证彩盒是否与工单对应
-                if (!dh.CheckExist("makeserial","ms_makecode='"+ma_code.Text+"' and ms_sncode = '"+sncode.Text+"'"))
+                //验证彩盒是否与产品对应
+                if (!dh.CheckExist("makeserial","ms_prodcode='"+pr_code.Text+"' and ms_sncode = '"+sncode.Text+"'"))
+                {
+                    OperateResult.AppendText("<<序列号"+sncode.Text+"对应产品编号不是"+pr_code.Text+"\n", Color.Red, sncode);
+                    return;
+                }
+                //验证所称彩盒是否重复
+                if (sncodes.Contains(sncode.Text))
                 {
-                    OperateResult.AppendText("<<序列号"+sncode.Text+"不在工单"+ma_code.Text+"中\n", Color.Red, sncode);
+                    OperateResult.AppendText("<<序列号" + sncode.Text + "已经称过\n", Color.Red, sncode);
                     return;
                 }
                 //记录重量
-                recordResult(showResult.Items.Count+1,sncode.Text, weight.Text, System.DateTime.Now.ToString());
+                recordResult(showResult.Items.Count+1,sncode.Text, weight.Text, System.DateTime.Now);
             }
         }
 
@@ -219,5 +244,10 @@ namespace UAS_MES.Packing
             //清空称量记录
             showResult.Items.Clear();
         }
+
+        private void ma_code_TextKeyDown(object sender, KeyEventArgs e)
+        {
+
+        }
     }
 }