瀏覽代碼

Merge remote-tracking branch 'refs/remotes/origin/master'

shim 8 年之前
父節點
當前提交
9dc3874ee9

+ 33 - 70
UAS-MES/FunctionCode/Make/Make_FeedingCollection.cs

@@ -27,7 +27,7 @@ namespace UAS_MES.Make
         string ms_craftcode;
         //Bom版本
         string ma_bomversion;
-        string ErrorMessage="";
+        string ErrorMessage = "";
 
         //用于提醒的序列B
         string[] RemainList = new string[0];
@@ -40,7 +40,7 @@ namespace UAS_MES.Make
         DataTable dt;
         //保存ListB中的数据
         DataTable dt1;
-        
+
 
 
         AutoSizeFormClass asc = new AutoSizeFormClass();
@@ -196,19 +196,6 @@ namespace UAS_MES.Make
                                 }
                             }
                             #endregion
-                            //不是第一道工序
-                            //else
-                            //{
-                            //    if (dh.CheckExist("makeserial", "ms_sncode='" + code.Text + "' and ms_status=1 and ms_nextstepcode='" + User.CurrentStepCode + "'"))
-                            //    {
-                            //        OperateResult.AppendText(">>获取序列号" + code.Text + "成功\n", Color.Green);
-                            //        sn_code.Text = code.Text;
-                            //        GetCollectItem();
-                            //        code.Text = "";
-                            //    }
-                            //    else
-                            //        OperateResult.AppendText(">>序列号" + code.Text + "错误\n", Color.Red);
-                            //}
                         }
                         else
                         {
@@ -248,12 +235,11 @@ namespace UAS_MES.Make
                                 if (dt.Rows.Count > 0)
                                 {
                                     if (dh.getRowCount("craftmaterial", "cm_sncode='" + sn_code.Text + "' and cm_barcode='" + code.Text + "' and cm_soncode='" + sp_soncode + "'") > 0)
-                                        OperateResult.AppendText(">>条码已采集过\n", Color.Red);
+                                        OperateResult.AppendText(">>条码" + code.Text + "已采集过\n", Color.Red);
                                     else
                                         Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
                                 }
-                                else
-                                    OperateResult.AppendText(">>序列号不存在\n", Color.Red);
+                                else OperateResult.AppendText(">>序列号不存在\n", Color.Red);
                             }
                             //单件管控物料
                             else if (pr_tracekind == "1")
@@ -272,11 +258,7 @@ namespace UAS_MES.Make
                                             Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
                                     }
                                 }
-                                else
-                                {
-                                    OperateResult.AppendText(">>条码不存在\n", Color.Red);
-                                    code.Text = "";
-                                }
+                                else OperateResult.AppendText(">>条码不存在\n", Color.Red, code);
                             }
                             //不管控
                             else if (pr_tracekind == "0")
@@ -293,17 +275,13 @@ namespace UAS_MES.Make
                                             Regex re = new Regex(sp_regex);
                                             if (re.IsMatch(code.Text))
                                                 Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
-                                            else
-                                                OperateResult.AppendText(">>正则表达式不匹配\n", Color.Red);
+                                            else OperateResult.AppendText(">>正则表达式不匹配\n", Color.Red);
                                         }
-                                        else
-                                            Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
+                                        else Save_OtherCode(sp_soncode, make_code, sn_code.Text, sp_id);
                                     }
-                                    else
-                                        OperateResult.AppendText(">>长度不匹配\n", Color.Red);
+                                    else OperateResult.AppendText(">>长度不匹配\n", Color.Red);
                                 }
-                                else
-                                    OperateResult.AppendText(">>前缀不匹配\n", Color.Red);
+                                else OperateResult.AppendText(">>前缀不匹配\n", Color.Red);
                             }
                         }
                         else
@@ -348,7 +326,7 @@ namespace UAS_MES.Make
                             string cm_stepcode = dt.Rows[0]["cm_stepcode"].ToString();
                             string cm_mccode = dt.Rows[0]["cm_mccode"].ToString();
                             dh.ExecuteSql("delete from Craftmaterial where cm_id=" + cm_id, "delete");
-                            LogicHandler.InsertMakeProcess(ms_macode, sn_code.Text,User.UserSourceCode, "上料采集操作", "下料成功", User.UserName);
+                            LogicHandler.InsertMakeProcess(ms_macode, sn_code.Text, User.UserSourceCode, "上料采集操作", "下料成功", User.UserName);
                             int count = dh.getRowCount("craftMaterial", "cm_mccode='" + cm_mccode + "' and cm_stepcode='" + cm_stepcode + "' and cm_sncode='" + sn_code.Text + "'");
                             if (count == 0)
                                 dh.UpdateByCondition("makecraftdetail ", "mcd_inqty=mcd_inqty-1,mcd_outqty=mcd_outqty-1,mcd_okqty = mcd_okqty - 1", "mcd_mccode='" + cm_mccode + "' and mcd_stepcode='" + cm_stepcode + "'");
@@ -378,8 +356,7 @@ namespace UAS_MES.Make
                                     OperateResult.AppendText(">>请采集需要下料的序列号\n", Color.Green);
                                     sn_code.Text = code.Text;
                                 }
-                                else
-                                    OperateResult.AppendText(">>该序列号未上料,无需下料\n", Color.Red);
+                                else OperateResult.AppendText(">>该序列号未上料,无需下料\n", Color.Red);
                             }
                         }
                         code.Text = "";
@@ -407,8 +384,9 @@ namespace UAS_MES.Make
                 nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
                 ms_status = dt.Rows[0]["ms_status"].ToString();
                 BaseUtil.SetFormValue(this.Controls, dt);
-                bool ifFirst;
-                if (LogicHandler.CheckCurrentStepAndIfFirst(code.Text, ma_code.Text, User.UserSourceCode, Tag.ToString(), out ifFirst, out ErrorMessage))
+                string oMakeCode = "";
+                string oMsID = "";
+                if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, code.Text, User.UserCode, out oMakeCode, out oMsID, out ErrorMessage))
                 {
                     //ms_status==1表示正在生产中,ms_status==2表示已完工
                     //并且当前的执行步骤和用户的岗位工序一致
@@ -419,7 +397,7 @@ namespace UAS_MES.Make
                         sql.Clear();
                         sql.Append("select sp_id,sp_prefix,sp_ifuseregex,sp_ifforsn,sp_length,sp_description,sp_soncode,pr_tracekind,pr_detail,pr_spec,sp_repcode,pr_id,");
                         sql.Append("sp_type,case when (sp_type='物料' and sp_soncode=pr_code) then '已采集' else '未采集' end sp_ifpick ,sp_prefix,");
-                        sql.Append("sp_length,sp_regex,sp_ifforsn from stepproduct left join product on pr_code=sp_soncode where sp_bomversion='"+ma_bomversion+"' and ");
+                        sql.Append("sp_length,sp_regex,sp_ifforsn from stepproduct left join product on pr_code=sp_soncode where sp_bomversion='" + ma_bomversion + "' and ");
                         sql.Append("sp_craftcode='" + ms_craftcode + "' and sp_stepcode='" + User.CurrentStepCode + "' And sp_mothercode ='" + make_prodcode + "' ");
                         sql.Append("and((sp_type = '物料' and( pr_tracekind <> 2 or pr_tracekind is null))or sp_type <> '物料') order by SP_DETNO asc");
                         dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
@@ -439,23 +417,11 @@ namespace UAS_MES.Make
                             sn_code.Text = "";
                         }
                     }
-                    else
-                    {
-                        OperateResult.AppendText(">>当前工单不在线或者岗位资源不对应\n", Color.Red);
-                        code.Text = "";
-                    }
-                }
-                else
-                {
-                    OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
-                    code.Text = "";
+                    else OperateResult.AppendText(">>当前工单不在线或者岗位资源不对应\n", Color.Red, code);
                 }
+                else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
             }
-            else
-            {
-                OperateResult.AppendText(">>序列号" + code.Text + "不存在\n", Color.Red);
-                code.Text = "";
-            }
+            else OperateResult.AppendText(">>序列号" + code.Text + "不存在\n", Color.Red, code);
         }
 
         //此类中通用的保存逻辑
@@ -486,36 +452,33 @@ namespace UAS_MES.Make
                         object sender = null;
                         ma_code_UserControlTextChanged(sender, e);
                     }
-                    else
-                    {
-                        OperateResult.AppendText(">>" + ErrorMessage + "\n");
-                        code.Text = "";
-                    }
+                    else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
                 }
             }
-            else
-            {
-                OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
-                code.Text = "";
-            }
+            else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
         }
 
         private void ClearSn_code_Click(object sender, EventArgs e)
         {
             sn_code.Clear();
+            dt1.Clear();
+            RemainIndex = 0;
         }
 
         private void ma_code_UserControlTextChanged(object sender, EventArgs e)
         {
-            mcd_inqty.Text = "";
-            mcd_remainqty.Text = "";
-            sql.Clear();
-            sql.Append("select mcd_inqty,ma_qty-mcd_inqty mcd_remainqty ");
-            sql.Append("from make left join makecraftdetail on mcd_macode=ma_code where ");
-            sql.Append("ma_code='" + ma_code.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
-            dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+            if (ma_code.Text.Length > 4)
+            {
+                mcd_inqty.Text = "";
+                mcd_remainqty.Text = "";
+                sql.Clear();
+                sql.Append("select mcd_inqty,ma_qty-mcd_inqty mcd_remainqty ");
+                sql.Append("from make left join makecraftdetail on mcd_macode=ma_code where ");
+                sql.Append("ma_code='" + ma_code.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
+                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 if (dt.Rows.Count > 0)
-                BaseUtil.SetFormValue(Controls, dt);
+                    BaseUtil.SetFormValue(Controls, dt);
+            }
         }
     }
 }

+ 12 - 18
UAS-MES/FunctionCode/Make/Make_PackageCollection.Designer.cs

@@ -57,7 +57,6 @@
             this.Clean = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.pa_packageqty = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.pr_code = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.pr_outboxinnerqty = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.pr_detail = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.pa_restqty = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.barcode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
@@ -67,9 +66,11 @@
             this.pd_innerqty = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pa_indate = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pd_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_outboxinnerqty = new System.Windows.Forms.NumericUpDown();
             this.panel2.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.PackageDetail)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.pr_outboxinnerqty)).BeginInit();
             this.SuspendLayout();
             // 
             // pr_code_label
@@ -406,21 +407,6 @@
             this.pr_code.Tag = "ma_prodcode";
             this.pr_code.TextChanged += new System.EventHandler(this.pr_code_TextChanged);
             // 
-            // pr_outboxinnerqty
-            // 
-            this.pr_outboxinnerqty.AllPower = null;
-            this.pr_outboxinnerqty.BackColor = System.Drawing.Color.White;
-            this.pr_outboxinnerqty.ID = null;
-            this.pr_outboxinnerqty.Location = new System.Drawing.Point(355, 149);
-            this.pr_outboxinnerqty.Name = "pr_outboxinnerqty";
-            this.pr_outboxinnerqty.Power = null;
-            this.pr_outboxinnerqty.Size = new System.Drawing.Size(150, 21);
-            this.pr_outboxinnerqty.Str = null;
-            this.pr_outboxinnerqty.Str1 = null;
-            this.pr_outboxinnerqty.Str2 = null;
-            this.pr_outboxinnerqty.TabIndex = 141;
-            this.pr_outboxinnerqty.Tag = "NoAuto";
-            // 
             // pr_detail
             // 
             this.pr_detail.AllPower = null;
@@ -533,11 +519,19 @@
             this.pd_id.ReadOnly = true;
             this.pd_id.Visible = false;
             // 
+            // pr_outboxinnerqty
+            // 
+            this.pr_outboxinnerqty.Location = new System.Drawing.Point(354, 150);
+            this.pr_outboxinnerqty.Name = "pr_outboxinnerqty";
+            this.pr_outboxinnerqty.Size = new System.Drawing.Size(151, 21);
+            this.pr_outboxinnerqty.TabIndex = 165;
+            // 
             // Make_PackageCollection
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1019, 608);
+            this.Controls.Add(this.pr_outboxinnerqty);
             this.Controls.Add(this.PrintNum);
             this.Controls.Add(this.pa_outboxcode);
             this.Controls.Add(this.label2);
@@ -552,7 +546,6 @@
             this.Controls.Add(this.Clean);
             this.Controls.Add(this.pa_packageqty);
             this.Controls.Add(this.pr_code);
-            this.Controls.Add(this.pr_outboxinnerqty);
             this.Controls.Add(this.pr_detail);
             this.Controls.Add(this.pa_restqty);
             this.Controls.Add(this.barcode);
@@ -582,6 +575,7 @@
             this.panel2.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.PackageDetail)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.pr_outboxinnerqty)).EndInit();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -607,7 +601,6 @@
         private CustomControl.TextBoxWithIcon.EnterTextBox barcode;
         private CustomControl.TextBoxWithIcon.EnterTextBox pa_restqty;
         private CustomControl.TextBoxWithIcon.EnterTextBox pr_detail;
-        private CustomControl.TextBoxWithIcon.EnterTextBox pr_outboxinnerqty;
         private CustomControl.TextBoxWithIcon.EnterTextBox pr_code;
         private CustomControl.TextBoxWithIcon.EnterTextBox pa_packageqty;
         private CustomControl.ButtonUtil.NormalButton Clean;
@@ -627,5 +620,6 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pd_innerqty;
         private System.Windows.Forms.DataGridViewTextBoxColumn pa_indate;
         private System.Windows.Forms.DataGridViewTextBoxColumn pd_id;
+        private System.Windows.Forms.NumericUpDown pr_outboxinnerqty;
     }
 }

+ 15 - 0
UAS-MES/FunctionCode/Make/Make_PackageCollection.resx

@@ -395,4 +395,19 @@
   <metadata name="pd_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="pd_barcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pa_outboxcode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pd_innerqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pa_indate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pd_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
 </root>