Browse Source

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

Hcsy 8 years ago
parent
commit
0bb1972717

+ 14 - 16
UAS-MES/FunctionCode/Make/Make_PalletWeigh.Designer.cs

@@ -58,7 +58,6 @@
             this.weightedNum = new UAS_MES.CustomControl.TextBoxWithIcon.NumOnlyTextBox();
             this.PA_PACKAGEQTY = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.pa_salecode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
-            this.pr_detailspec = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.pa_prodcode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.pa_totalqty = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.pa_makecode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
@@ -66,6 +65,7 @@
             this.OperateResult = new UAS_MES.CustomControl.RichText.RichTextAutoBottom();
             this.Printer = new UAS_MES.CustomControl.ComBoxWithFocus.PrinterCombox();
             this.palletcode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.pr_detailspec = new System.Windows.Forms.Label();
             this.panel4.SuspendLayout();
             this.SuspendLayout();
             // 
@@ -76,7 +76,7 @@
             this.panel4.Controls.Add(this.label22);
             this.panel4.Controls.Add(this.weight);
             this.panel4.Location = new System.Drawing.Point(46, 92);
-            this.panel4.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.panel4.Margin = new System.Windows.Forms.Padding(4);
             this.panel4.Name = "panel4";
             this.panel4.Size = new System.Drawing.Size(552, 186);
             this.panel4.TabIndex = 92;
@@ -160,7 +160,7 @@
             this.PrintLabel.Font = new System.Drawing.Font("宋体", 9F);
             this.PrintLabel.FormattingEnabled = true;
             this.PrintLabel.Location = new System.Drawing.Point(1125, 100);
-            this.PrintLabel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.PrintLabel.Margin = new System.Windows.Forms.Padding(4);
             this.PrintLabel.Name = "PrintLabel";
             this.PrintLabel.Size = new System.Drawing.Size(196, 26);
             this.PrintLabel.TabIndex = 162;
@@ -400,17 +400,6 @@
             this.pa_salecode.Size = new System.Drawing.Size(0, 39);
             this.pa_salecode.TabIndex = 183;
             // 
-            // pr_detailspec
-            // 
-            this.pr_detailspec.AutoSize = true;
-            this.pr_detailspec.CutLength = null;
-            this.pr_detailspec.Font = new System.Drawing.Font("微软雅黑", 15F);
-            this.pr_detailspec.Location = new System.Drawing.Point(176, 513);
-            this.pr_detailspec.MaximumSize = new System.Drawing.Size(200, 0);
-            this.pr_detailspec.Name = "pr_detailspec";
-            this.pr_detailspec.Size = new System.Drawing.Size(0, 39);
-            this.pr_detailspec.TabIndex = 182;
-            // 
             // pa_prodcode
             // 
             this.pa_prodcode.AutoSize = true;
@@ -497,11 +486,21 @@
             this.palletcode.TabIndex = 94;
             this.palletcode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.palletcode_KeyDown);
             // 
+            // pr_detailspec
+            // 
+            this.pr_detailspec.AutoSize = true;
+            this.pr_detailspec.Font = new System.Drawing.Font("微软雅黑", 15F);
+            this.pr_detailspec.Location = new System.Drawing.Point(176, 513);
+            this.pr_detailspec.Name = "pr_detailspec";
+            this.pr_detailspec.Size = new System.Drawing.Size(0, 39);
+            this.pr_detailspec.TabIndex = 192;
+            // 
             // Make_PalletWeigh
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1402, 902);
+            this.Controls.Add(this.pr_detailspec);
             this.Controls.Add(this.ComList);
             this.Controls.Add(this.showResult);
             this.Controls.Add(this.BaudRate);
@@ -510,7 +509,6 @@
             this.Controls.Add(this.weightedNum);
             this.Controls.Add(this.PA_PACKAGEQTY);
             this.Controls.Add(this.pa_salecode);
-            this.Controls.Add(this.pr_detailspec);
             this.Controls.Add(this.pa_prodcode);
             this.Controls.Add(this.pa_totalqty);
             this.Controls.Add(this.pa_makecode);
@@ -572,7 +570,6 @@
         private CustomControl.ValueLabel.ValueLabel pa_makecode;
         private CustomControl.ValueLabel.ValueLabel pa_totalqty;
         private CustomControl.ValueLabel.ValueLabel pa_prodcode;
-        private CustomControl.ValueLabel.ValueLabel pr_detailspec;
         private CustomControl.ValueLabel.ValueLabel pa_salecode;
         private CustomControl.ValueLabel.ValueLabel PA_PACKAGEQTY;
         private CustomControl.TextBoxWithIcon.NumOnlyTextBox weightedNum;
@@ -585,5 +582,6 @@
         private System.Windows.Forms.ColumnHeader columnHeader3;
         private System.Windows.Forms.ColumnHeader columnHeader4;
         private CustomControl.ValueLabel.ValueLabel ComList;
+        private System.Windows.Forms.Label pr_detailspec;
     }
 }

+ 11 - 0
UAS-MES/FunctionCode/Make/Make_PalletWeigh.cs

@@ -120,6 +120,11 @@ namespace UAS_MES.Make
                         {
                             try
                             {
+                                if (PrintLabel.SelectedValue.ToString()=="") {
+                                    OperateResult.AppendText(">>产品:" + pa_prodcode.Text + "未维护栈板标签模板\n", Color.Red);
+                                    palletcode.Text = "";
+                                    return;
+                                }
                                 Print.CodeSoft(lbl, PrintLabel.Text.Split(':')[1], PrintLabel.SelectedValue.ToString(), Printer.Text, palletcode.Text, int.Parse(printNum.Text), indate[PrintLabel.SelectedIndex]);
                             }
                             catch (Exception ex)
@@ -127,6 +132,7 @@ namespace UAS_MES.Make
                                 OperateResult.AppendText("<<打印失败\n", Color.Red);
                                 OperateResult.AppendText(">>请输入栈板号\n", Color.Green);
                                 palletcode.Text = "";
+                                return;
                             }
                             //打印成功,请输入栈板号
                             OperateResult.AppendText("<<打印成功\n", Color.Green);
@@ -138,6 +144,11 @@ namespace UAS_MES.Make
                             //刷新称重计数+1
                             weightedNum.Text = int.Parse(weightedNum.Text) + 1 + "";
                             //刷新grid的历史称重信息;
+                            if (int.Parse(weight.Text)==0) {
+                                OperateResult.AppendText("<<重量不能等于0\n", Color.Red);
+                                palletcode.Text = "";
+                                return;
+                            }
                             recordResult(palletcode.Text,weight.Text, System.DateTime.Now.ToString());
                             //清空输入框中的值,扫描框置空定焦
                             palletcode.Text = "";

+ 50 - 39
UAS-MES/FunctionCode/Make/Make_SeqProgramTransform.cs

@@ -43,6 +43,8 @@ namespace UAS_MES.Make
         StringBuilder s1 = new StringBuilder();
         //存放工单中数量
         int ma_qty;
+        //存放第一步查询出来的工单号,判断是否更换了工单
+        string makecode;
         public Make_SeqProgramTransform()
         {
             InitializeComponent();
@@ -77,63 +79,72 @@ namespace UAS_MES.Make
 
                             string oMakecode = "";
                             string oMsid = "";
-                            //核对工序
-                            if (LogicHandler.CheckStepSNAndMacode(ms_macode.Text, User.UserSourceCode, code.Text, User.UserCode, out oMakecode, out oMsid, out errorMessage))
+                            //记录当前序列号查出来的工单
+                            if (LogicHandler.GetMakeInfo(code.Text, out makecode, out errorMessage))
                             {
-                                //核对TSN是否正确
-                                string beforesn = dh.getFieldDataByCondition("makeserial", "ms_beforesn", "ms_sncode='" + code.Text + "'").ToString().Trim();
-                                if (beforesn == "" || beforesn == null)
+                                //核对工序
+                                if (LogicHandler.CheckStepSNAndMacode(makecode == ms_macode.Text ? makecode : "", User.UserSourceCode, code.Text, User.UserCode, out oMakecode, out oMsid, out errorMessage))
                                 {
-                                    //按照out出的工单号查出工单相关信息,并赋值到相关控件
-                                    sql.Clear();
-                                    sql.Append("select ma_code as ms_macode,mcd_okqty,ma_qty,ma_qty-mcd_inqty as remain_qty,pr_detail,pr_code as ma_prodcode ");
-                                    sql.Append("from makeserial left join make on ms_makecode=ma_code left join product on ");
-                                    sql.Append("ms_prodcode=pr_code left join makecraftdetail on ms_makecode=mcd_macode where ms_sncode=:sncode and mcd_stepcode='" + User.CurrentStepCode + "'");
-                                    dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select", code.Text);
-                                    if (dt.Rows.Count > 0)
+                                    //核对TSN是否正确
+                                    string beforesn = dh.getFieldDataByCondition("makeserial", "ms_beforesn", "ms_sncode='" + code.Text + "'").ToString().Trim();
+                                    if (beforesn == "" || beforesn == null)
                                     {
-                                        //记录数量
-                                        ma_qty = int.Parse(dt.Rows[0]["ma_qty"].ToString());
-                                        BaseUtil.SetFormValue(this.Controls, dt);
-                                        //判断用户是否锁定输入TSN长度,
-                                        if (!checkLengthOrPre(TSNLength_checkBox, TSNLength, "长度","TSN"))
+                                        //按照out出的工单号查出工单相关信息,并赋值到相关控件
+                                        sql.Clear();
+                                        sql.Append("select ma_code as ms_macode,mcd_okqty,ma_qty,ma_qty-mcd_inqty as remain_qty,pr_detail,pr_code as ma_prodcode ");
+                                        sql.Append("from makeserial left join make on ms_makecode=ma_code left join product on ");
+                                        sql.Append("ms_prodcode=pr_code left join makecraftdetail on ms_makecode=mcd_macode where ms_sncode=:sncode and mcd_stepcode='" + User.CurrentStepCode + "'");
+                                        dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select", code.Text);
+                                        if (dt.Rows.Count > 0)
                                         {
+                                            //记录数量
+                                            ma_qty = int.Parse(dt.Rows[0]["ma_qty"].ToString());
+                                            BaseUtil.SetFormValue(this.Controls, dt);
+                                            //判断用户是否锁定输入TSN长度,
+                                            if (!checkLengthOrPre(TSNLength_checkBox, TSNLength, "长度", "TSN"))
+                                            {
+                                                return;
+                                            }
+                                            //判断用户是否锁定输入TSN前缀,
+                                            if (!checkLengthOrPre(TSNPre_checkBox, TSNPre, "前缀", "TSN"))
+                                            {
+                                                return;
+                                            }
+                                        }
+                                        else
+                                        {
+                                            OperateResult.AppendText(">>序列号" + code.Text + "不存在\n", Color.Red);
+                                            code.Text = "";
                                             return;
                                         }
-                                        //判断用户是否锁定输入TSN前缀,
-                                        if (!checkLengthOrPre(TSNPre_checkBox, TSNPre, "前缀","TSN"))
+                                        //获取需要关联采集的信息,以及校验规则
+                                        ListA = (DataTable)dh.ExecuteSql("select * from productsnrelation where psr_prodcode='" + ma_prodcode.Text + "' order by psr_detno", "select");
+                                        //没有获取到就提示错误请维护产品对应的关联采集信息
+                                        if (ListA.Rows.Count == 0)
                                         {
+                                            OperateResult.AppendText(">>请维护产品对应的关联采集信息\n", Color.Red);
+                                            OperateResult.AppendText("<<请输入TSN\n", Color.Green);
                                             return;
                                         }
+                                        step = 1;
+
+                                        //记录转换前的序列号
+                                        TSN = code.Text;
+                                        code.Text = "";
+                                        OperateResult.AppendText("<<请输入SN\n", Color.Green);
                                     }
                                     else
+                                    //不为空,进行过转换。不勾选修改结果,就不能再修改
                                     {
-                                        OperateResult.AppendText(">>序列号" + code.Text + "不存在\n", Color.Red);
+                                        OperateResult.AppendText(">>序列号" + code.Text + "已进行了转换\n", Color.Red);
                                         code.Text = "";
-                                        return;
+                                        OperateResult.AppendText("<<请重新输入TSN\n", Color.Green);
                                     }
-                                    //获取需要关联采集的信息,以及校验规则
-                                    ListA = (DataTable)dh.ExecuteSql("select * from productsnrelation where psr_prodcode='" + ma_prodcode.Text + "' order by psr_detno", "select");
-                                    //没有获取到就提示错误请维护产品对应的关联采集信息
-                                    if (ListA.Rows.Count == 0)
-                                    {
-                                        OperateResult.AppendText(">>请维护产品对应的关联采集信息\n", Color.Red);
-                                        OperateResult.AppendText("<<请输入TSN\n", Color.Green);
-                                        return;
-                                    }
-                                    step = 1;
-
-                                    //记录转换前的序列号
-                                    TSN = code.Text;
-                                    code.Text = "";
-                                    OperateResult.AppendText("<<请输入SN\n", Color.Green);
                                 }
                                 else
-                                //不为空,进行过转换。不勾选修改结果,就不能再修改
                                 {
-                                    OperateResult.AppendText(">>序列号" + code.Text + "已进行了转换\n", Color.Red);
+                                    OperateResult.AppendText(">>" + errorMessage + "\n", Color.Red);
                                     code.Text = "";
-                                    OperateResult.AppendText("<<请重新输入TSN\n", Color.Green);
                                 }
                             }
                             else