章政 8 жил өмнө
parent
commit
de6f46dae7

+ 51 - 19
UAS-MES/FunctionCode/Make/Make_GetReMakeSN.Designer.cs

@@ -29,6 +29,7 @@
         private void InitializeComponent()
         {
             this.groupBoxWithBorder1 = new UAS_MES.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
+            this.ma_id = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.ma_craftcode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.ma_saveimei = new UAS_MES.CustomControl.CustomCheckBox.CustomCheckBox();
             this.ma_savemacbt = new UAS_MES.CustomControl.CustomCheckBox.CustomCheckBox();
@@ -48,7 +49,7 @@
             this.groupBoxWithBorder2 = new UAS_MES.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
             this.PrintLabel = new System.Windows.Forms.ComboBox();
             this.PrintLabel_label = new System.Windows.Forms.Label();
-            this.autoPrintCheckBox1 = new UAS_MES.CustomControl.CustomCheckBox.AutoPrintCheckBox();
+            this.AutoPrint = new UAS_MES.CustomControl.CustomCheckBox.AutoPrintCheckBox();
             this.PrinterList_label = new System.Windows.Forms.Label();
             this.PrinterList = new UAS_MES.CustomControl.ComBoxWithFocus.PrinterCombox();
             this.OperateResult = new UAS_MES.CustomControl.RichText.RichTextAutoBottom();
@@ -57,10 +58,12 @@
             this.ReWorkAsCurrentSN = new System.Windows.Forms.RadioButton();
             this.label1 = new System.Windows.Forms.Label();
             this.sn_code = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
-            this.ma_id = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
+            this.PrintNum = new System.Windows.Forms.NumericUpDown();
+            this.label2 = new System.Windows.Forms.Label();
             this.groupBoxWithBorder1.SuspendLayout();
             this.groupBoxWithBorder2.SuspendLayout();
             this.groupBoxWithBorder3.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).BeginInit();
             this.SuspendLayout();
             // 
             // groupBoxWithBorder1
@@ -92,6 +95,17 @@
             this.groupBoxWithBorder1.Text = "工单信息";
             this.groupBoxWithBorder1.TextColor = System.Drawing.Color.Black;
             // 
+            // ma_id
+            // 
+            this.ma_id.AutoSize = true;
+            this.ma_id.CutLength = null;
+            this.ma_id.Location = new System.Drawing.Point(793, 143);
+            this.ma_id.MaximumSize = new System.Drawing.Size(200, 0);
+            this.ma_id.Name = "ma_id";
+            this.ma_id.Size = new System.Drawing.Size(0, 27);
+            this.ma_id.TabIndex = 16;
+            this.ma_id.Visible = false;
+            // 
             // ma_craftcode
             // 
             this.ma_craftcode.AutoSize = true;
@@ -101,6 +115,7 @@
             this.ma_craftcode.Name = "ma_craftcode";
             this.ma_craftcode.Size = new System.Drawing.Size(0, 27);
             this.ma_craftcode.TabIndex = 15;
+            this.ma_craftcode.Visible = false;
             // 
             // ma_saveimei
             // 
@@ -264,9 +279,11 @@
             // groupBoxWithBorder2
             // 
             this.groupBoxWithBorder2.BorderColor = System.Drawing.Color.Black;
+            this.groupBoxWithBorder2.Controls.Add(this.label2);
+            this.groupBoxWithBorder2.Controls.Add(this.PrintNum);
             this.groupBoxWithBorder2.Controls.Add(this.PrintLabel);
             this.groupBoxWithBorder2.Controls.Add(this.PrintLabel_label);
-            this.groupBoxWithBorder2.Controls.Add(this.autoPrintCheckBox1);
+            this.groupBoxWithBorder2.Controls.Add(this.AutoPrint);
             this.groupBoxWithBorder2.Controls.Add(this.PrinterList_label);
             this.groupBoxWithBorder2.Controls.Add(this.PrinterList);
             this.groupBoxWithBorder2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -297,14 +314,14 @@
             this.PrintLabel_label.TabIndex = 15;
             this.PrintLabel_label.Text = "产品名称";
             // 
-            // autoPrintCheckBox1
+            // AutoPrint
             // 
-            this.autoPrintCheckBox1.Checked = false;
-            this.autoPrintCheckBox1.Location = new System.Drawing.Point(141, 138);
-            this.autoPrintCheckBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
-            this.autoPrintCheckBox1.Name = "autoPrintCheckBox1";
-            this.autoPrintCheckBox1.Size = new System.Drawing.Size(125, 31);
-            this.autoPrintCheckBox1.TabIndex = 14;
+            this.AutoPrint.Checked = false;
+            this.AutoPrint.Location = new System.Drawing.Point(141, 139);
+            this.AutoPrint.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
+            this.AutoPrint.Name = "AutoPrint";
+            this.AutoPrint.Size = new System.Drawing.Size(124, 31);
+            this.AutoPrint.TabIndex = 14;
             // 
             // PrinterList_label
             // 
@@ -396,15 +413,27 @@
             this.sn_code.TabIndex = 0;
             this.sn_code.KeyDown += new System.Windows.Forms.KeyEventHandler(this.sn_code_KeyDown);
             // 
-            // ma_id
+            // PrintNum
             // 
-            this.ma_id.AutoSize = true;
-            this.ma_id.CutLength = null;
-            this.ma_id.Location = new System.Drawing.Point(793, 143);
-            this.ma_id.MaximumSize = new System.Drawing.Size(200, 0);
-            this.ma_id.Name = "ma_id";
-            this.ma_id.Size = new System.Drawing.Size(0, 27);
-            this.ma_id.TabIndex = 16;
+            this.PrintNum.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.PrintNum.Location = new System.Drawing.Point(403, 139);
+            this.PrintNum.Name = "PrintNum";
+            this.PrintNum.Size = new System.Drawing.Size(120, 27);
+            this.PrintNum.TabIndex = 17;
+            this.PrintNum.Value = new decimal(new int[] {
+            1,
+            0,
+            0,
+            0});
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(301, 139);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(92, 27);
+            this.label2.TabIndex = 18;
+            this.label2.Text = "打印份数";
             // 
             // Make_GetReMakeSN
             // 
@@ -427,6 +456,7 @@
             this.groupBoxWithBorder2.PerformLayout();
             this.groupBoxWithBorder3.ResumeLayout(true);
             this.groupBoxWithBorder3.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.PrintNum)).EndInit();
             this.ResumeLayout(true);
 
         }
@@ -451,7 +481,7 @@
         private CustomControl.RichText.RichTextAutoBottom OperateResult;
         private CustomControl.GroupBoxWithBorder.GroupBoxWithBorder groupBoxWithBorder3;
         private CustomControl.ComBoxWithFocus.PrinterCombox PrinterList;
-        private CustomControl.CustomCheckBox.AutoPrintCheckBox autoPrintCheckBox1;
+        private CustomControl.CustomCheckBox.AutoPrintCheckBox AutoPrint;
         private System.Windows.Forms.Label PrinterList_label;
         private System.Windows.Forms.Label PrintLabel_label;
         private System.Windows.Forms.ComboBox PrintLabel;
@@ -463,5 +493,7 @@
         private CustomControl.CustomCheckBox.CustomCheckBox ma_savemacbt;
         private CustomControl.ValueLabel.ValueLabel ma_craftcode;
         private CustomControl.ValueLabel.ValueLabel ma_id;
+        private System.Windows.Forms.NumericUpDown PrintNum;
+        private System.Windows.Forms.Label label2;
     }
 }

+ 26 - 33
UAS-MES/FunctionCode/Make/Make_GetReMakeSN.cs

@@ -108,8 +108,8 @@ namespace UAS_MES.Make
                 {
                     //判断是否是途程第一道工序
                     sql.Clear();
-                    sql.Append("select cd_id from craft left join craftdetail on cd_crid=cr_id where cr_craftcode='" + ma_craftcode.Text + "' ");
-                    sql.Append("and cr_prodcode='" + pr_code.Text + "' and nvl(cd_iffirst,0)<>0 and cd_stepcode='" + User.CurrentStepCode + "'");
+                    sql.Append("select cd_id from craft left join craftdetail on cd_crid=cr_id where cr_code='" + ma_craftcode.Text + "' ");
+                    sql.Append("and cr_prodcode='" + pr_code.Text + "' and nvl(cd_firststep,0)<>0 and cd_stepcode='" + User.CurrentStepCode + "'");
                     dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                     if (dt.Rows.Count > 0)
                     {
@@ -121,13 +121,14 @@ namespace UAS_MES.Make
                             {
                                 //序列号信息
                                 sql.Clear();
-                                sql.Append("select ms_beforesn,ms_firstsn,ms_outboxcode,ms_nextmacode,ms_prodcode,ms_salecode,");
-                                sql.Append("MS_IMEI1,MS_MAC,MS_NETCODE,MS_MEID,ms_imei2,ms_imei13,ms_othid1,ms_othid2,ms_othid3");
+                                sql.Append("select ms_beforesn,ms_makecode,ms_firstsn,ms_outboxcode,ms_nextmacode,ms_prodcode,ms_salecode,");
+                                sql.Append("MS_IMEI1,MS_MAC,MS_NETCODE,MS_MEID,ms_imei2,ms_imei3,ms_othid1,ms_othid2,ms_othid3");
                                 sql.Append(",MS_OTHCODE3,MS_OTHCODE2,MS_OTHCODE1,ms_bt from makeserial where ms_id='" + Msid + "'");
                                 DataTable SnInf = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                                string ms_prodcode = SnInf.Rows[0]["ma_prodcode"].ToString();
-                                string ms_salecode = SnInf.Rows[0]["ma_salecode"].ToString();
+                                string ms_prodcode = SnInf.Rows[0]["ms_prodcode"].ToString();
+                                string ms_salecode = SnInf.Rows[0]["ms_salecode"].ToString();
                                 string ms_beforesn = SnInf.Rows[0]["ms_beforesn"].ToString();
+                                string ms_makecode = SnInf.Rows[0]["ms_makecode"].ToString();
                                 //判断是否已装箱
                                 if (SnInf.Rows[0]["ms_outboxcode"].ToString() != "")
                                 {
@@ -142,14 +143,14 @@ namespace UAS_MES.Make
                                 }
                                 //工单信息
                                 sql.Clear();
-                                sql.Append("select ma_salecode,ma_prodcode,ma_inqty,ma_craftcode,ma_qty,nvl(ma_inqty,0) ma_inqty,");
+                                sql.Append("select ma_salecode,ma_prodcode,ma_craftname,ma_inqty,ma_craftcode,ma_qty,nvl(ma_inqty,0) ma_inqty,");
                                 sql.Append("nvl(ma_scrapqty,0)ma_scrapqty,ma_id,nvl(ma_unlimitin,0) ma_unlimitin,ma_wccode from make ");
                                 sql.Append("where ma_code='" + ma_code.Text + "'and ma_kind='返工' and  ma_statuscode='STARTED'");
                                 DataTable MaInf = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                                 string ma_prodcode = MaInf.Rows[0]["ma_prodcode"].ToString();
                                 string ma_salecode = MaInf.Rows[0]["ma_salecode"].ToString();
                                 int ma_unlimitin = int.Parse(MaInf.Rows[0]["ma_unlimitin"].ToString());
-                                int ma_iqnty = int.Parse(MaInf.Rows[0]["ma_iqnty"].ToString());
+                                int ma_inqty = int.Parse(MaInf.Rows[0]["ma_inqty"].ToString());
                                 int ma_scrapqty = int.Parse(MaInf.Rows[0]["ma_scrapqty"].ToString());
                                 int ma_qty = int.Parse(MaInf.Rows[0]["ma_qty"].ToString());
                                 if (ma_prodcode != ms_prodcode)
@@ -162,27 +163,15 @@ namespace UAS_MES.Make
                                     OperateResult.AppendText(">>序列号所属合同" + ms_salecode + "与返工工单合同不一致\n", Color.Red, sn_code);
                                     return;
                                 }
-                                if (ma_unlimitin == 0 && ma_iqnty - ma_scrapqty + 1 > ma_qty)
+                                if (ma_unlimitin == 0 && ma_inqty - ma_scrapqty + 1 > ma_qty)
                                 {
                                     OperateResult.AppendText(">>工单不允许超数投产\n", Color.Red, sn_code);
                                     return;
                                 }
-                                string SN = "";
-                                if (ReWorkAsCurrentSN.Checked)
+                                if (ReWorkAsRelateTSN.Checked && ms_beforesn == "")
                                 {
-                                    SN = sn_code.Text;
-                                }
-                                else if (ReWorkAsRelateTSN.Checked)
-                                {
-                                    if (ms_beforesn != "")
-                                    {
-                                        SN = sn_code.Text;
-                                    }
-                                    else
-                                    {
-                                        OperateResult.AppendText(">>TSN不存在\n", Color.Red, sn_code);
-                                        return;
-                                    }
+                                    OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在TSN\n", Color.Red, sn_code);
+                                    return;
                                 }
                                 string netcode = "";
                                 string imeid = "";
@@ -228,25 +217,33 @@ namespace UAS_MES.Make
                                 if (salecode == "")
                                 {
                                     salecode = SnInf.Rows[0]["ms_salecode"].ToString();
-                                    dh.ExecuteSql("update make set ma_salecode='" + salecode + "' where ma_id='" + ma_id + "'", "update");
+                                    dh.ExecuteSql("update make set ma_salecode='" + salecode + "' where ma_id='" + ma_id.Text + "'", "update");
                                 }
                                 sql.Clear();
                                 sql.Append("insert into MakeSerial(ms_id,ms_code,ms_sncode,ms_prodcode,ms_indate,ms_wccode");
                                 sql.Append(",ms_craftcode,ms_craftname,ms_nextstepcode,ms_status,ms_makecode,ms_linecode");
                                 sql.Append(",ms_sourcecode,ms_maid,ms_firstsn,ms_salecode,ms_mac,ms_bt,ms_othcode1,ms_othcode2,");
-                                sql.Append("ms_othcode3,ms_netcode,ms_imei1,ms_imei2,ms_imei13,ms_meid,ms_othid1,ms_othid2,ms_othid3 ");
-                                sql.Append("values(MakeSerial_seq.nextval,'" + SN + "','" + SN + "','" + pr_code.Text + "',");
+                                sql.Append("ms_othcode3,ms_netcode,ms_imei1,ms_imei2,ms_imei3,ms_meid,ms_othid1,ms_othid2,ms_othid3)");
+                                sql.Append("values(MakeSerial_seq.nextval,'" + sn_code.Text + "','" + sn_code.Text + "','" + pr_code.Text + "',");
                                 sql.Append("sysdate,'" + workcenter + "','" + craftcode + "','" + craftname + "','" + User.CurrentStepCode + "',");
                                 sql.Append("1,'" + ma_code.Text + "','" + User.UserLineCode + "','" + User.UserSourceCode + "','" + ma_id.Text + "',");
                                 sql.Append("'" + firstsn + "','" + salecode + "','" + mac + "','" + bt + "','" + othcode1 + "','" + othcode2 + "','" + othcode3 + "',");
                                 sql.Append("'" + netcode + "','" + imei1 + "','" + imei2 + "','" + imei3 + "','" + imeid + "','" + othid1 + "','" + othid2 + "','" + othid3 + "')");
                                 dh.ExecuteSql(sql.GetString(), "insert");
-                                dh.ExecuteSql("update make set ma_inqty=nvl(ma_inqty,0)+1 where ma_id='" + ma_id + "'", "update");
+                                dh.ExecuteSql("update make set ma_inqty=nvl(ma_inqty,0)+1 where ma_id='" + ma_id.Text + "'", "update");
                                 dh.ExecuteSql("update makeserial set ms_nextmacode='" + ma_code.Text + "' where ms_id='" + Msid + "'", "update");
                                 if (ReWorkAsRelateTSN.Checked)
                                 {
-
+                                    dh.ExecuteSql("update makeserial set ms_nextmacode='" + ma_code.Text + "' where ms_sncode='" + ms_beforesn + "' and ms_nextmacode='" + ms_makecode + "'", "update");
+                                }
+                                OperateResult.AppendText(">>序列号" + sn_code.Text + "归属工单" + ma_code.Text + "成功。\n", Color.Green);
+                                if (AutoPrint.Checked)
+                                {
+                                    OperateResult.AppendText(">>打印序列号" + sn_code.Text + "\n", Color.Black);
+                                    Print.CodeSoft(lbl, PrintLabel.Text.Split(':')[1], PrintLabel.SelectedValue.ToString(), PrinterList.Text, sn_code.Text, int.Parse(PrintNum.Text), indate[PrintLabel.SelectedIndex]);
+                                    dh.UpdateByCondition("makeserial", "ms_printcount=nvl(ms_printcount,0)+1", "ms_sncode='" + sn_code.Text + "'");
                                 }
+                                sn_code.Clear();
                             }
                             else OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在\n", Color.Red, sn_code);
                         }
@@ -278,10 +275,6 @@ namespace UAS_MES.Make
                         ma_savemacbt.Checked = true;
                     }
                 }
-                //else
-                //{
-                //    OperateResult.AppendText(">>不存在返工工单" + ma_code.Text + "\n", Color.Red);
-                //}
             }
         }
     }