瀏覽代碼

Merge branch 'master' of ssh://10.10.101.21/source/mes-client

章政 8 年之前
父節點
當前提交
41238d88a7

+ 1 - 1
UAS-MES/CustomControl/HeadBar/HeadBar.cs

@@ -61,7 +61,7 @@ namespace UAS_MES.CustomControl
                 if (logout_confirm == "Yes")
                 {
                     this.FindForm().Close();
-                    Application.Exit();
+                    System.Environment.Exit(0);
                 }
             }
             else

+ 26 - 0
UAS-MES/FunctionCode/Make/Make_Decompose.cs

@@ -170,6 +170,32 @@ namespace UAS_MES.Make
 
         private void Decompose_Click(object sender, EventArgs e)
         {
+            sql.Clear();
+            sql.Append("select max(ms_id) from makeserial where ms_sncode ='" + sn_code.Text + "' or ms_sncode = (select  max(SN)");
+            sql.Append(" from  makesnrelation left join makeserial on ms_makecode=makecode where beforesn='" + sn_code.Text + "')");
+            dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+            ms_id = dt.Rows[0][0].ToString();
+            if (ms_id != "")
+            {
+                sql.Clear();
+                sql.Append("select ms_id,ms_status,ms_makecode,ms_prodcode,pr_detail pr_name,ms_sncode,ms_firstsn,ms_craftcode,ms_craftname,ms_wccode from makeserial left join product on pr_code=ms_prodcode where ms_id='" + ms_id + "'");
+                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                if (!(dt.Rows[0]["ms_status"].ToString() == "0" || dt.Rows[0]["ms_status"].ToString() == "3"))
+                {
+                    OperateResult.AppendText(">>序列号" + ms_sncode.Text + "必须处于维修或未采集状态才能做拆解\n", Color.Red, sn_code);
+                    BaseUtil.CleanForm(this);
+                    sn_code.Focus();
+                    return;
+                }           
+            }
+            else
+            {
+                ms_id = null;
+                OperateResult.AppendText(">>序列号" + sncode_1 + "不存在\n", Color.Red, sn_code);
+                BaseUtil.CleanForm(this);
+                sn_code.Focus();
+                return;
+            }
             Boolean decompose = false;
             for (int i = 0; i < LabelDataGridView.Rows.Count; i++)
             {

+ 8 - 8
UAS-MES/FunctionCode/Make/Make_SeqProgramTransform.cs

@@ -86,7 +86,7 @@ namespace UAS_MES.Make
                         //为0,输入TSN
                         if (step == 0)
                         {
-                            OperateResult.AppendText(">>序列号:" + code.Text + ", 发送请求\n", Color.Black);
+                            OperateResult.AppendText(">>TSN号" + code.Text + "\n", Color.Black);
 
                             //记录当前序列号查出来的工单
                             if (GetMakeInfo(code.Text, out makecode, out errorMessage))
@@ -111,7 +111,7 @@ namespace UAS_MES.Make
                                         }
                                         else
                                         {
-                                            OperateResult.AppendText(">>序列号" + code.Text + "不存在\n", Color.Red, code);
+                                            OperateResult.AppendText(">>TSN号" + code.Text + "不存在\n", Color.Red, code);
                                             return;
                                         }
                                     }
@@ -135,13 +135,13 @@ namespace UAS_MES.Make
                                             TSN = code.Text;
                                             //显示序列号
                                             show_sncode.Text = TSN;
-                                            OperateResult.AppendText("<<请输入转换后的序列号\n", Color.Green,code);
+                                            OperateResult.AppendText("<<请输入SN\n", Color.Green,code);
                                             ChangeResult.Enabled = false;
                                         }
                                         else
                                         {
                                             OperateResult.AppendText(">>不存在该已转序列号:" + code.Text + "\n", Color.Red, code);
-                                            OperateResult.AppendText("<<请重新输入序列号\n", Color.Black);
+                                            OperateResult.AppendText("<<请重新输入TSN\n", Color.Black);
                                         }
                                     }
                                     else
@@ -170,14 +170,14 @@ namespace UAS_MES.Make
                                                 TSN = code.Text;
                                                 //显示序列号
                                                 show_sncode.Text = TSN;
-                                                OperateResult.AppendText("<<请输入转换后的序列号\n", Color.Green, code);
+                                                OperateResult.AppendText("<<请输入SN\n", Color.Green, code);
                                                 ChangeResult.Enabled = false;
                                                 onlyPass = true;
                                             }
                                             else
                                             {
                                                 OperateResult.AppendText(">>序列号:" + code.Text + "已转换过\n", Color.Red, code);
-                                                OperateResult.AppendText("<<请重新输入序列号\n", Color.Black);
+                                                OperateResult.AppendText("<<请重新输入TSN\n", Color.Black);
                                             }
                                         }
                                     }
@@ -201,7 +201,7 @@ namespace UAS_MES.Make
                                 if (!dh.CheckExist("makesnlist", "msl_makecode='" + oMakecode + "' and msl_sncode='" + code.Text + "'  and msl_type='after'"))
                                 {
                                     //有序列号清单,输入的序列号却不在范围内
-                                    OperateResult.AppendText(">>序列号" + code.Text + "错误,不在工单设定的序列号范围内\n", Color.Red, code);
+                                    OperateResult.AppendText(">>SN号" + code.Text + "错误,不在工单设定的转换后序列号清单中\n", Color.Red, code);
                                     return;
                                 }
                             }
@@ -218,7 +218,7 @@ namespace UAS_MES.Make
                             //判断转换后序列号的范围是否合法
                             if (!checkStartAndEnd())
                             {
-                                OperateResult.AppendText(">>序列号" + code.Text + "校验错误,不在工单防呆规则指定范围内!\n", Color.Red, code);
+                                OperateResult.AppendText(">>SN号" + code.Text + "校验错误,不在工单防呆规则指定范围内!\n", Color.Red, code);
                                 return;
                             }
                             //如果只是需要过站的序列号

+ 14 - 14
UAS-MES/FunctionCode/Make/Make_SeqTransform.cs

@@ -46,7 +46,7 @@ namespace UAS_MES.Make
             asc.controllInitializeSize(this);
             dh = new DataHelper();
             sncode.Focus();
-            OperateResult.AppendText(">>请输入要转换的序列号\n", Color.Black);
+            OperateResult.AppendText(">>请输入TSN号\n", Color.Black);
 
             ////设置锁定工单
             //ms_makecode_lock.GetMakeCodeCtl(ma_code);
@@ -75,7 +75,7 @@ namespace UAS_MES.Make
                 {
                     if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out errorMessage))
                     {
-                        OperateResult.AppendText(">>序列号:" + sncode.Text + ", 发送请求\n", Color.Black);
+                        OperateResult.AppendText(">>TSN号" + sncode.Text + "\n", Color.Black);
                         //如果用户没有输入工单号自行去后台查询
                         //通过工单序列号关系验证
                         //bsncode为空,就说明是输入转换之前的序列号
@@ -87,7 +87,7 @@ namespace UAS_MES.Make
                             if (oMakeCode == "")
                             {
                                 OperateResult.AppendText(">>序列号:" + sncode.Text + "未归属工单\n", Color.Red);
-                                OperateResult.AppendText(">>请输入转换前的序列号\n", Color.Black, sncode);
+                                OperateResult.AppendText(">>请输入TSN号\n", Color.Black, sncode);
                                 return;
                             }
                             //用户填写了工单号,那么序列号必须要是该工单的,否则提示错误
@@ -119,13 +119,13 @@ namespace UAS_MES.Make
                                             bsncode = sncode.Text;
                                             //显示序列号
                                             show_sncode.Text = bsncode;
-                                            OperateResult.AppendText("<<请输入转换后的序列号\n", Color.Green, sncode);
+                                            OperateResult.AppendText("<<请输入SN号\n", Color.Green, sncode);
                                             ChangeResult.Enabled = false;
                                         }
                                         else
                                         {
                                             OperateResult.AppendText(">>不存在该已转序列号:" + sncode.Text + "\n", Color.Red, sncode);
-                                            OperateResult.AppendText("<<请重新输入序列号\n", Color.Black);
+                                            OperateResult.AppendText("<<请重新输入TSN号\n", Color.Black);
                                         }
                                         break;
                                     case CheckState.Unchecked:
@@ -138,7 +138,7 @@ namespace UAS_MES.Make
                                             bsncode = sncode.Text;
                                             //显示序列号
                                             show_sncode.Text = bsncode;
-                                            OperateResult.AppendText("<<请输入转换后的序列号\n", Color.Green, sncode);
+                                            OperateResult.AppendText("<<请输入SN号\n", Color.Green, sncode);
                                             ChangeResult.Enabled = false;
                                         }
                                         else
@@ -150,14 +150,14 @@ namespace UAS_MES.Make
                                                 bsncode = sncode.Text;
                                                 //显示序列号
                                                 show_sncode.Text = bsncode;
-                                                OperateResult.AppendText("<<请输入转换后的序列号\n", Color.Green, sncode);
+                                                OperateResult.AppendText("<<请输入SN号\n", Color.Green, sncode);
                                                 ChangeResult.Enabled = false;
                                                 flag = true;
                                             }
                                             else
                                             {
                                                 OperateResult.AppendText(">>序列号:" + sncode.Text + "已转换过\n", Color.Red, sncode);
-                                                OperateResult.AppendText("<<请重新输入序列号\n", Color.Black);
+                                                OperateResult.AppendText("<<请重新输入TSN号\n", Color.Black);
                                             }
                                         }
                                         break;
@@ -179,7 +179,7 @@ namespace UAS_MES.Make
                                 if (!dh.CheckExist("makesnlist", "msl_makecode='" + oMakeCode + "' and msl_sncode='" + sncode.Text + "'  and msl_type='after'"))
                                 {
                                     //有序列号清单,输入的序列号却不在范围内
-                                    OperateResult.AppendText(">>序列号" + sncode.Text + "错误,不在工单设定的序列号范围内\n", Color.Red, sncode);
+                                    OperateResult.AppendText(">>SN号" + sncode.Text + "错误,不在工单设定的转换后序列号清单中\n", Color.Red, sncode);
                                     return;
                                 }
                             }
@@ -192,7 +192,7 @@ namespace UAS_MES.Make
                             //判断输入的转换后序列号是否符合起始终止
                             if (!checkStartAndEnd())
                             {
-                                OperateResult.AppendText(">>序列号" + sncode.Text + "校验错误,不在工单防呆规则指定范围内!\n", Color.Red, sncode);
+                                OperateResult.AppendText(">>SN号" + sncode.Text + "校验错误,不在工单防呆规则指定范围内!\n", Color.Red, sncode);
                                 return;
                             }
                             //如果只是需要过站的序列号
@@ -250,7 +250,7 @@ namespace UAS_MES.Make
                                     //记录日志
                                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "序列转换", "转换成功", sncode.Text, "");
                                     LogManager.DoLog("修改序列号:" + bsncode + "为" + sncode.Text + "成功!" + "操作人:" + User.UserCode);
-                                    OperateResult.AppendText(">>请输入转换前的序列号\n", Color.Black);
+                                    OperateResult.AppendText(">>请输入TSN号\n", Color.Black);
                                     //置空
                                     bsncode = "";
                                     show_sncode.Text = "";
@@ -303,7 +303,7 @@ namespace UAS_MES.Make
         private void ReCall_Click(object sender, EventArgs e)
         {
             bsncode = "";
-            OperateResult.AppendText(">>请输需要转换的序列号\n", Color.Green, show_sncode);
+            OperateResult.AppendText(">>请输入TSN号\n", Color.Green, show_sncode);
             ChangeResult.Enabled = true;
             flag = false;
         }
@@ -474,7 +474,7 @@ namespace UAS_MES.Make
                     {
                         //序列号校验错误,长度错误
                         OperateResult.AppendText(">>序列号" + sncode.Text + "校验错误,长度错误\n", Color.Red, sncode);
-                        OperateResult.AppendText("<<请重新输入序列号\n", Color.Black);
+                        OperateResult.AppendText("<<请重新输入SN号\n", Color.Black);
                         return false;
                     }
                 }
@@ -496,7 +496,7 @@ namespace UAS_MES.Make
                     {
                         //序列号校验错误,前缀错误
                         OperateResult.AppendText(">>序列号" + sncode.Text + "校验错误,前缀错误\n", Color.Red, sncode);
-                        OperateResult.AppendText("<<请重新输入序列号\n", Color.Black);
+                        OperateResult.AppendText("<<请重新输入SN号\n", Color.Black);
                         return false;
                     }
                 }

+ 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);

+ 47 - 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,9 @@ 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);
-
             //更新已称重量最大值最小值
             if (index > 1)
             {
@@ -86,7 +91,15 @@ namespace UAS_MES.Packing
             {
                 maxValue = weigh;
                 minValue = weigh;
+                //每次添加第一条数据的时候清空list的值
+                sncodes.Clear();
+                indates.Clear();
+                weights.Clear();
             }
+            //将重量信息加到集合中
+            sncodes.Add(palletcode);
+            indates.Add(time.ToString("yyyy-MM-dd HH:mm:ss"));
+            weights.Add(weigh);
         }
 
         private void startWeigh_Click(object sender, EventArgs e)
@@ -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,27 @@ 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_sncode = '" + sncode.Text + "'"))
                 {
-                    OperateResult.AppendText("<<序列号"+sncode.Text+"不在工单"+ma_code.Text+"中\n", Color.Red, sncode);
+                    OperateResult.AppendText("<<序列号" + sncode.Text + "不存在\n", Color.Red, sncode);
+                    return;
+                }
+                //验证彩盒是否与产品对应
+                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 + "已经称过\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);
+                sncode.Text = "";
             }
         }
 
@@ -218,6 +250,14 @@ namespace UAS_MES.Packing
             OperateResult.AppendText("<<重量设置需采样个数为" + samplesCount + "\n", Color.Black);
             //清空称量记录
             showResult.Items.Clear();
+            indates.Clear();
+            sncodes.Clear();
+            weights.Clear();
+        }
+
+        private void ma_code_TextKeyDown(object sender, KeyEventArgs e)
+        {
+
         }
     }
 }

+ 1 - 0
UAS-MES/FunctionCode/Warehouse/Warehouse_FinishedProductOut.cs

@@ -226,6 +226,7 @@ namespace UAS_MES.Warehouse
         {
             if (e.KeyCode == Keys.Enter)
             {
+                needMakeIn = dh.GetConfig("needMakeIn", "MESSetting").ToString();
                 if (input.Text == "")
                 {
                     OperateResult.AppendText("录入信息不能为空\n", Color.Red, input);