Forráskód Böngészése

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

Hcsy 8 éve
szülő
commit
da2ef1f226

+ 1 - 1
UAS-MES/FunctionCode/Make/Make_FuselageLabelPrint.cs

@@ -115,7 +115,7 @@ namespace UAS_MES.Make
                                     pr_change = false;
                                     if (MessageBox.Show("是否使用默认标签", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
                                     {
-                                        OperateResult.AppendText(">>产品编号改变,重新选择标签模板\n", Color.Green);
+                                        OperateResult.AppendText(">>请选择标签模板\n", Color.Green);
                                         return;
                                     }
                                 }

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

+ 34 - 34
UAS-MES/FunctionCode/Make/Make_GetReMakeSN.cs

@@ -108,32 +108,27 @@ 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)
                     {
                         if (sn_code.Text != "")
                         {
                             //判断序列号是否有效
-                            string Msid = dh.getFieldDataByCondition("makeserial ", "max(ms_id)", "ms_sncode='" + sn_code.Text + "'").ToString();
+                            string Msid = dh.getFieldDataByCondition("makeserial ", "max(ms_id)", "ms_sncode='" + sn_code.Text + "' and ms_makecode<>'" + ma_code.Text + "'").ToString();
                             if (Msid != "")
                             {
                                 //序列号信息
                                 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();
-                                //判断是否已装箱
-                                if (SnInf.Rows[0]["ms_outboxcode"].ToString() != "")
-                                {
-                                    OperateResult.AppendText(">>序列号已经装箱:" + SnInf.Rows[0]["ms_outboxcode"].ToString() + ",需要从箱内移除才可以进行返工归属\n", Color.Red, sn_code);
-                                    return;
-                                }
+                                string ms_makecode = SnInf.Rows[0]["ms_makecode"].ToString();
                                 //判断序列号是否已经被使用
                                 if (SnInf.Rows[0]["ms_nextmacode"].ToString() != "")
                                 {
@@ -142,14 +137,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,25 +157,21 @@ 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)
-                                {
-                                    SN = sn_code.Text;
-                                }
-                                else if (ReWorkAsRelateTSN.Checked)
+                                string Sn = sn_code.Text;
+                                if (ReWorkAsRelateTSN.Checked)
                                 {
                                     if (ms_beforesn != "")
                                     {
-                                        SN = sn_code.Text;
+                                        Sn = ms_beforesn;
                                     }
                                     else
                                     {
-                                        OperateResult.AppendText(">>TSN不存在\n", Color.Red, sn_code);
+                                        OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在TSN\n", Color.Red, sn_code);
                                         return;
                                     }
                                 }
@@ -228,27 +219,40 @@ 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 + "','" + Sn + "','" + 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);
+                                getsnqty.Text = dh.getFieldDataByCondition("makeserial ", "count(1)", "ms_makecode='" + ma_code.Text + "'").ToString();
+                                if (AutoPrint.Checked)
+                                {
+                                    if (PrintLabel.Items.Count != 0)
+                                    {
+                                        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 + "'");
+                                    }
+                                    else OperateResult.AppendText(">>" + pr_code.Text + "未维护标签\n", Color.Black);
                                 }
+                                sn_code.Clear();
                             }
-                            else OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在\n", Color.Red, sn_code);
+                            else OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在或者已绑定工单\n", Color.Red, sn_code);
                         }
                         else OperateResult.AppendText(">>序列号不允许为空\n", Color.Red, sn_code);
                     }
@@ -278,10 +282,6 @@ namespace UAS_MES.Make
                         ma_savemacbt.Checked = true;
                     }
                 }
-                //else
-                //{
-                //    OperateResult.AppendText(">>不存在返工工单" + ma_code.Text + "\n", Color.Red);
-                //}
             }
         }
     }

+ 26 - 11
UAS-MES/FunctionCode/Make/Make_RePrintLabel.cs

@@ -247,7 +247,7 @@ namespace UAS_MES.Make
                 //打印成功,记录日志commandlog , cl_operate彩盒或者机身标补打印,cl_result补打印成功
                 LogicHandler.DoCommandLog(User.UserCode, "", User.UserLineCode, User.UserSourceCode, giftBox.Checked?"彩盒标补打印":"机身标补打印", "补打印成功", inputValue.Text, "");
                 //如果ms_downstatus<>0,则更新ms_downstatus=-1 where ms_id=?id,同时插入记录至表 MAKEDOWN
-                if (mapB.Rows[0]["ms_downstatus"].ToString()!="0")
+                if (mapB.Rows[0]["ms_downstatus"].ToString()=="0")
                 {
                     dh.ExecuteSql("update makeserial set ms_downstatus='-1' where ms_id='"+ms_id+"'","update");
                     //插入数据
@@ -268,9 +268,14 @@ namespace UAS_MES.Make
                 OperateResult.AppendText("<<打印成功\n", Color.Green);
                 Print.CodeSoft(lbl, PrintLabel.Text.Split(':')[1], PrintLabel.SelectedValue.ToString(), Printer.Text, inputValue.Text, int.Parse(printNum.Text), indate[PrintLabel.SelectedIndex]);
                 //打印成功,记录日志commandlog , cl_operate彩盒或者机身标补打印,cl_result补打印成功
-                LogicHandler.DoCommandLog(User.UserCode, "", User.UserLineCode, User.UserSourceCode, "卡通箱标签补打印,箱号:"+ inputValue.Text, "补打印成功","", "");
+                //LogicHandler.DoCommandLog(User.UserCode, "", User.UserLineCode, User.UserSourceCode, "卡通箱标签补打印,箱号:"+ inputValue.Text, "补打印成功","", "");
+                sql.Clear();
+                sql.Append("insert into commandlog(cl_id,cl_man,cl_date,cl_linecode,cl_sourcecode,cl_makecode,cl_operate,");
+                sql.Append("cl_result,cl_sncode,cl_code) values (commandlog_seq.nextval,:inman,sysdate,:linecode,:sourcecode,:makecode,");
+                sql.Append(":operate,:result,'','')");
+                dh.ExecuteSql(sql.GetString(), "insert",User.UserCode,User.UserLineCode,User.UserSourceCode,ms_makecode.Text,"卡通箱标签补打印,箱号:" + inputValue.Text, "补打印成功");
                 //如果pa_downstatus<>0,则更新pa_downstatus=-1 where pa_outboxcode=?code,同时插入记录至表 MAKEDOWN
-                if (mapB.Rows[0]["pa_downstatus"].ToString()!="0") {
+                if (mapB.Rows[0]["pa_downstatus"].ToString()=="0") {
                     dh.ExecuteSql("update package set pa_downstatus='-1' where pa_outboxcode='"+ inputValue.Text+"'", "update");
                     //插入MakeDown表
                     putInfo2MakeDown();
@@ -308,8 +313,8 @@ namespace UAS_MES.Make
             //拼接sql插入语句
             sql.Clear();
             sql.Append("INSERT INTO MAKEDOWN (MD_ID,MD_LINECODE,MD_SCCODE,MD_STEPCODE,");
-            sql.Append("MD_SNCODE,MD_PRODCODE,MD_MACODE, MD_DOWNREASON, MD_CODE,");
-            sql.Append("MD_DOWNDATE,MD_DOWNMAN,MD_STATUS) value(MAKEDOWN_seq.nextval,'" + User.UserLineCode + "','" + User.UserSourceCode + "',");
+            sql.Append(CartonBox.Checked?"MD_OUTBOXCODE":"MD_SNCODE"+",MD_PRODCODE,MD_MACODE, MD_DOWNREASON, MD_CODE,");
+            sql.Append("MD_DOWNDATE,MD_DOWNMAN,MD_STATUS) values (MAKEDOWN_seq.nextval,'" + User.UserLineCode + "','" + User.UserSourceCode + "',");
             sql.Append("'" + User.CurrentStepCode + "','" + inputValue.Text + "','" + pr_code.Text + "','" + ms_makecode.Text + "','补打标签','" + md_code + "',sysdate,'" + User.UserCode + "','-1')");
             //执行
             dh.ExecuteSql(sql.GetString(), "insert");
@@ -365,7 +370,9 @@ namespace UAS_MES.Make
                             LogicHandler.DoCommandLog(User.UserCode, "", User.UserLineCode, User.UserSourceCode, "标签补打核对", "核对成功", TSN, "");
                         }
                         else
-                        OperateResult.AppendText("<<核对失败\n", Color.Red);
+                        {
+                            OperateResult.AppendText("<<核对失败\n", Color.Red);
+                        }
                         //清空TSN的值
                         TSN = "";
                         rePrintCheck.Text = "";
@@ -377,7 +384,7 @@ namespace UAS_MES.Make
                     //第一次输入
                     if (TSN == "")
                     {
-                        infoc = (DataTable)dh.ExecuteSql("select pa_prodcode,pa_downstatus from package where pa_outboxcode='"+rePrintCheck.Text+"' and pa_type=1", "select");
+                        infoc = (DataTable)dh.ExecuteSql("select pa_prodcode,pa_makecode,pa_downstatus from package where pa_outboxcode='"+rePrintCheck.Text+"' and pa_type=1", "select");
                         //如果查询无值,提示用户卡通箱号不存在,请输入卡通箱号
                         if (infoc.Rows.Count==0)
                         {
@@ -393,20 +400,28 @@ namespace UAS_MES.Make
                     else
                     {
                         //比对两次输入的是否一致
-                        if (TSN==rePrintCheck.Text)
+                        if (TSN == rePrintCheck.Text)
                         {
                             //提示用户核对成功
                             OperateResult.AppendText("<<核对成功\n", Color.Green);
                             //如果卡通箱号是下地状态 pa_downstatus<>0 ,更新pa_downstatus=0;
-                            if (infoc.Rows[0]["pa_downstatus"].ToString()!="0")
+                            if (infoc.Rows[0]["pa_downstatus"].ToString() != "0")
                             {
                                 sql.Clear();
                                 sql.Append("update makedown set md_status=0,Md_UPREASON='标签补打核对',Md_UPMAN='" + User.UserCode + "',Md_UPDATE=SYSDATE WHERE Md_OUTBOXCODE='" + TSN + "' AND Md_PRODCODE='" + infoc.Rows[0]["pa_prodcode"].ToString() + "' AND Md_STATUS=-1");
                             }
                             //记录操作日志commandlog , 补打核对,核对成功
-                            LogicHandler.DoCommandLog(User.UserCode, "", User.UserLineCode, User.UserSourceCode, "标签补打核对,卡通箱号:"+TSN, "核对成功", "", "");
+                            //LogicHandler.DoCommandLog(User.UserCode, "", User.UserLineCode, User.UserSourceCode, "标签补打核对,卡通箱号:" + TSN, "核对成功", "", "");
+                            sql.Clear();
+                            sql.Append("insert into commandlog(cl_id,cl_man,cl_date,cl_linecode,cl_sourcecode,cl_makecode,cl_operate,");
+                            sql.Append("cl_result,cl_sncode,cl_code) values (commandlog_seq.nextval,:inman,sysdate,:linecode,:sourcecode,:makecode,");
+                            sql.Append(":operate,:result,'','')");
+                            dh.ExecuteSql(sql.GetString(), "insert", User.UserCode, User.UserLineCode, User.UserSourceCode,infoc.Rows[0]["pa_makecode"].ToString(), "标签补打核对,卡通箱号:" + TSN, "核对成功");
+                        }
+                        else
+                        {
+                            OperateResult.AppendText("<<核对失败\n", Color.Red);
                         }
-                        OperateResult.AppendText("<<核对失败\n", Color.Red);
                         //清空TSN的值
                         TSN = "";
                         rePrintCheck.Text = "";

+ 1 - 1
UAS-出货标签管理/UAS-出货标签管理.csproj

@@ -67,7 +67,7 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <PropertyGroup>
-    <ManifestCertificateThumbprint>4FA99E585616700DE7B55D9E1B52AECEA80A31C9</ManifestCertificateThumbprint>
+    <ManifestCertificateThumbprint>0702B5BD480611CA32663309A8FD3717B722E307</ManifestCertificateThumbprint>
   </PropertyGroup>
   <PropertyGroup>
     <ManifestKeyFile>

+ 95 - 36
UAS_MesInterface/MESHelper.cs

@@ -25,7 +25,6 @@ namespace BenQGuru.eMES.DLLService
         bool SetMobileData(string iTSN, string iSN, string iSourceCode, string iMPKind, string iResult, string iErrCode, string flag, out string oErrorMessage);
         bool SetPcbaData(string iSN, string iResCode, string iOperator, string iResult, string iErrCode, out string oErrMessage);
         bool GoMo(string iMO, string iSN, string iResCode, out string oErrMessage);
-        int Add(int a, int b);
     }
 
     [Guid("41EAB546-6EF4-464A-895A-9C34013A5D8C")]
@@ -39,15 +38,15 @@ namespace BenQGuru.eMES.DLLService
         //用于存放批量执行的SQL
         List<string> sqls = new List<string>();
         //系统默认的的连接字符串
-        private string ConnectionStrings = "Password=select!#%*(;User ID=MES_TEST;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=117.25.180.218)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        private string ConnectionStrings = "Password=select!#%*(;User ID=MES_TEST;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.230.200)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
         //用户选择的数据库的连接字符串
-        private OracleConnection connection = new OracleConnection("Password=select!#%*(;User ID=MES_TEST;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=117.25.180.218)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));");
+        private OracleConnection connection;
         //用户选择的数据库的连接字符串
         private OracleCommand command = null;
 
         public MESHelper()
         {
-
+            connection = new OracleConnection(ConnectionStrings);
         }
 
         /// <summary>
@@ -59,6 +58,11 @@ namespace BenQGuru.eMES.DLLService
         /// <returns></returns>
         public bool CheckRoutePassed(string iSN, string iResCode, out string oErrMessage)
         {
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
             oErrMessage = "";
             string[] param = new string[] { "", iResCode, iSN, "", "", "", oErrMessage };
             string[] ParamName = new string[] { "v_i_macode", "v_i_sourcecode", "v_i_sncode", "v_i_usercode", "v_o_macode", "v_o_msid", "v_o_errmsg" };
@@ -101,6 +105,11 @@ namespace BenQGuru.eMES.DLLService
         public bool CheckUserAndResourcePassed(string iUserCode, string iResCode, string iPassWord, out string oErrMessage)
         {
             oErrMessage = "";
+            if (iUserCode == "" || iPassWord == "" || iResCode == "")
+            {
+                oErrMessage = "用户名,密码,岗位资源必须填写";
+                return false;
+            }
             if (CheckUserLogin(iUserCode, iPassWord, out oErrMessage))
             {
                 string SQL = "select em_code,em_type,em_name from employee where em_code=:UserName ";
@@ -169,6 +178,11 @@ namespace BenQGuru.eMES.DLLService
             oCode1 = "";
             oCode2 = "";
             oCdoe3 = "";
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
             oErrMessage = "";
             string omakeCode = "";
             GetRcardMOInfo(iSN, out omakeCode, out oErrMessage);
@@ -191,7 +205,7 @@ namespace BenQGuru.eMES.DLLService
         /// 输入的 SN 号查找在制品是否有 IMEI 信息存在,如果存在则将 IMEI 信息传出,如果没有则在该工单下未使用的 IMEI 中随机分配一组
         /// 如果iIMEI1、iNetCode不为空,则分别作为获取的附件加条件。
         /// </summary>
-        /// <param name="iSnCode"></param>
+        /// <param name="iSN"></param>
         /// <param name="iIMEI1"></param>
         /// <param name="iNetCode"></param>
         /// <param name="oIMEI1"></param>
@@ -205,7 +219,7 @@ namespace BenQGuru.eMES.DLLService
         /// <param name="oID3"></param>
         /// <param name="oErrMessage"></param>
         /// <returns></returns>
-        public bool GetMEIOrNetCodeRange(string iSnCode, string iIMEI1, string iNetCode, out string oIMEI1, out string oIMEI2, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrMessage)
+        public bool GetMEIOrNetCodeRange(string iSN, string iIMEI1, string iNetCode, out string oIMEI1, out string oIMEI2, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrMessage)
         {
             oIMEI1 = "";
             oIMEI2 = "";
@@ -217,8 +231,13 @@ namespace BenQGuru.eMES.DLLService
             oID3 = "";
             oID4 = "";
             oID5 = "";
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
             oErrMessage = "";
-            string[] param = new string[] { iSnCode, "", iIMEI1, iNetCode, oIMEI1, oIMEI2, "", oMEID, oNetCode, oPSN, oID1, oID2, oID3, oErrMessage };
+            string[] param = new string[] { iSN, "", iIMEI1, iNetCode, oIMEI1, oIMEI2, "", oMEID, oNetCode, oPSN, oID1, oID2, oID3, oErrMessage };
             string[] ParamName = new string[] { "v_i_sncode", "v_i_macode", "v_i_imei", "v_i_netcode", "v_o_imei1", "v_o_imei2", "v_o_imei3", "v_o_meid", "v_o_netcode", "v_o_psn", "v_o_id1", "v_o_id2", "v_o_id3", "v_o_errmsg" };
             CallProcedure("CS_GETIMEIORNETCODERANGE", ParamName, ref param);
             oIMEI1 = param[4];
@@ -247,6 +266,11 @@ namespace BenQGuru.eMES.DLLService
         {
             //取MakeProcess表中的执行记录ID最大的一个工单的号码
             oMoCode = "";
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
             oErrMessage = "";
             string ms_id = getFieldDataByCondition("MakeSerial", "max(ms_id) ms_id", "ms_sncode='" + iSN + "' or ms_firstsn in (select firstsn from makesnrelation where sn='" + iSN + "')").ToString();
             oMoCode = getFieldDataByCondition("MakeSerial", "ms_makecode", "ms_id='" + ms_id + "'").ToString();
@@ -279,9 +303,9 @@ namespace BenQGuru.eMES.DLLService
         /// <param name="oID3"></param>
         /// <param name="oID4"></param>
         /// <param name="oID5"></param>
-        /// <param name="oErrorMessage"></param>
+        /// <param name="oErrMessage"></param>
         /// <returns></returns>
-        public bool GetMobileAllInfo(string iSN, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCode3, out string oIMEI1, out string oIMEI2, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrorMessage)
+        public bool GetMobileAllInfo(string iSN, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCode3, out string oIMEI1, out string oIMEI2, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrMessage)
         {
             oBT = "";
             oMEID = "";
@@ -298,6 +322,11 @@ namespace BenQGuru.eMES.DLLService
             oID3 = "";
             oID4 = "";
             oID5 = "";
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
             //通过序列号获取最近操作的工单号
             string ms_id = getFieldDataByCondition("makeserial", "ms_id", "ms_sncode='" + iSN + "'").ToString();
             if (ms_id != "")
@@ -318,18 +347,18 @@ namespace BenQGuru.eMES.DLLService
                     oID1 = dt.Rows[0]["ms_othid3"].ToString();
                     oID2 = dt.Rows[0]["ms_othid3"].ToString();
                     oID3 = dt.Rows[0]["ms_othid3"].ToString();
-                    oErrorMessage = "";
+                    oErrMessage = "";
                     return true;
                 }
                 else
                 {
-                    oErrorMessage = "序列号" + iSN + "不存在";
+                    oErrMessage = "序列号" + iSN + "不存在";
                     return false;
                 }
             }
             else
             {
-                oErrorMessage = "序列号" + iSN + "不存在";
+                oErrMessage = "序列号" + iSN + "不存在";
                 return false;
             }
         }
@@ -367,24 +396,34 @@ namespace BenQGuru.eMES.DLLService
         /// <param name="iCode1"></param>
         /// <param name="iCode2"></param>
         /// <param name="iCode3"></param>
-        /// <param name="oErrorMessage"></param>
+        /// <param name="oErrMessage"></param>
         /// <returns></returns>
-        public bool SetAddressInfo(string iSN, string iWIFI, string iBT, string iCode1, string iCode2, string iCode3, out string oErrorMessage)
+        public bool SetAddressInfo(string iSN, string iWIFI, string iBT, string iCode1, string iCode2, string iCode3, out string oErrMessage)
         {
-            oErrorMessage = "";
-            string[] param = new string[] { iSN, iWIFI, iBT, iCode1, iCode2, iCode3, oErrorMessage };
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            string[] param = new string[] { iSN, iWIFI, iBT, iCode1, iCode2, iCode3, oErrMessage };
             string[] ParamName = new string[] { "v_i_sncode", "v_i_mac", "v_i_bt", "v_i_code1", "v_i_code2", "v_i_code3", "v_o_errmsg" };
             CallProcedure("CS_SETADDRESSINFO", ParamName, ref param);
-            oErrorMessage = param[6];
-            if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
+            oErrMessage = param[6];
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
                 return true;
             else
                 return false;
         }
 
-        public bool SetStepFinish(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, string iErrCode, out string oErrorMessage)
+        public bool SetStepFinish(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, string iErrCode, out string oErrMessage)
         {
-            oErrorMessage = "";
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
             string StepCode = getFieldDataByCondition("Makeserial", "ms_stepcode", "ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'").ToString();
             string CurrentStep = GetStepCodeBySource(iSourceCode);
             switch (iResult)
@@ -394,7 +433,7 @@ namespace BenQGuru.eMES.DLLService
                 case "NG":
                     if (iErrCode == "")
                     {
-                        oErrorMessage = "测试结果为NG时必须传递不良代码";
+                        oErrMessage = "测试结果为NG时必须传递不良代码";
                         return false;
                     }
                     else
@@ -413,11 +452,11 @@ namespace BenQGuru.eMES.DLLService
                         }
                         ExecuteSQLTran(InsertSQL.ToArray());
                         //将不良的序列号的状态码设为3
-                        ExecuteSql("update makeserial set ms_status='3' where ms_sncode=:sncode and ms_makecode=:macode", "update", iSN, iMakeCode);
+                        ExecuteSql("update makeserial set ms_status='3' where ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'", "update");
                     }
                     break;
                 default:
-                    oErrorMessage = "测试结果必须为NG或者OK";
+                    oErrMessage = "测试结果必须为NG或者OK";
                     return false;
             }
             //不良采集为良品是更新
@@ -437,7 +476,7 @@ namespace BenQGuru.eMES.DLLService
                     }
                 }
             }
-            return CS_SetFinish(iMakeCode, iSourceCode, iSN, iUserCode, iResult, out oErrorMessage);
+            return CS_SetFinish(iMakeCode, iSourceCode, iSN, iUserCode, iResult, out oErrMessage);
         }
 
         /// <summary>
@@ -464,14 +503,19 @@ namespace BenQGuru.eMES.DLLService
                 return false;
         }
 
-        private bool CS_SetFinish(string iMakeCode, string iSourceCode, string iSN, string iUserCode, string iResult, out string oErrorMessage)
+        private bool CS_SetFinish(string iMakeCode, string iSourceCode, string iSN, string iUserCode, string iResult, out string oErrMessage)
         {
-            oErrorMessage = "";
-            string[] param = new string[] { iMakeCode, iSourceCode, iSN, iUserCode, iResult, oErrorMessage };
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            string[] param = new string[] { iMakeCode, iSourceCode, iSN, iUserCode, iResult, oErrMessage };
             string[] ParamName = new string[] { "v_i_macode", "v_i_sourcecode", "v_i_sncode", "v_i_usercode", "v_i_result", "v_o_errmsg" };
             CallProcedure("CS_SETSTEPRESULT", ParamName, ref param);
-            oErrorMessage = param[5];
-            if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
+            oErrMessage = param[5];
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
                 return true;
             else
                 return false;
@@ -496,6 +540,11 @@ namespace BenQGuru.eMES.DLLService
         /// <returns></returns>
         public bool SetTestDetail(string iSN, string iClass, string iSubClass1, string iSubClass2, string iSubClass3, string iMaxValue, string iMinValue, string iActualValue, string iValue1, string iValue2, string iValue3, string iTestResult, string iResCode, out string oErrMessage)
         {
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
             oErrMessage = "";
             sql.Length = 0;
             string omakeCode;
@@ -527,10 +576,15 @@ namespace BenQGuru.eMES.DLLService
         /// <param name="iID3"></param>
         /// <param name="oErrorMessage"></param>
         /// <returns></returns>
-        public bool SetIMEIInfo(string iSnCode, string iIMEI1, out string oErrMessage)
+        public bool SetIMEIInfo(string iSN, string iIMEI1, out string oErrMessage)
         {
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
             oErrMessage = "";
-            string[] param = new string[] { iSnCode, iIMEI1, "", "", "", "", "", "", "", "", oErrMessage };
+            string[] param = new string[] { iSN, iIMEI1, "", "", "", "", "", "", "", "", oErrMessage };
             string[] ParamName = new string[] { "v_i_sncode", "v_i_imei1", "v_i_imei2", "v_i_imei3", "v_i_meid", "v_i_netcode", "v_i_psn", "v_i_id1", "v_i_id2", "v_i_id3", "v_o_errmsg" };
             CallProcedure("CS_SETIMEIINFO", ParamName, ref param);
             oErrMessage = param[10];
@@ -542,6 +596,11 @@ namespace BenQGuru.eMES.DLLService
 
         public bool SetPcbaData(string iSN, string iResCode, string iOperator, string iResult, string iErrCode, out string oErrMessage)
         {
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
             oErrMessage = "";
             string omakecode = "";
             string[] param = new string[] { "", iResCode, iSN, "", omakecode, "", oErrMessage };
@@ -557,6 +616,11 @@ namespace BenQGuru.eMES.DLLService
 
         public bool GoMo(string iMO, string iSN, string iResCode, out string oErrMessage)
         {
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
             oErrMessage = "";
             string[] param = new string[] { iMO, iResCode, iSN, "", "", "", oErrMessage };
             string[] ParamName = new string[] { "v_i_macode", "v_i_sourcecode", "v_i_sncode", "v_i_usercode", "v_o_macode", "v_o_msid", "v_o_errmsg" };
@@ -960,10 +1024,5 @@ namespace BenQGuru.eMES.DLLService
                 cmd.Connection.Open();
             }
         }
-
-        public int Add(int a, int b)
-        {
-            return a + b;
-        }
     }
 }

+ 1 - 1
UAS_MesInterface/UAS_MesDllService(3.5).csproj

@@ -9,7 +9,7 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>BenQGuru.eMES.DLLService</RootNamespace>
     <AssemblyName>BenQGuru.eMES.DLLService</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <TargetFrameworkProfile />
   </PropertyGroup>