소스 검색

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

Hcsy 8 년 전
부모
커밋
d8e3af7e11

+ 1 - 1
UAS-MES/CustomControl/CustomCheckBox/AutoPrintCheckBox.Designer.cs

@@ -12,7 +12,7 @@
         /// </summary>
         /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
         protected override void Dispose(bool disposing)
-        {
+        { 
             if (disposing && (components != null))
             {
                 components.Dispose();

+ 1 - 1
UAS-MES/CustomControl/CustomCheckBox/AutoPrintCheckBox.cs

@@ -12,7 +12,7 @@ namespace UAS_MES.CustomControl.CustomCheckBox
 {
     public partial class AutoPrintCheckBox : UserControl
     {
-
+         
         public AutoPrintCheckBox()
         {
             InitializeComponent();

+ 4 - 0
UAS-MES/FunctionCode/Make/Make_CustomLabelPrint.Designer.cs

@@ -86,6 +86,7 @@
             this.PrintLabel.Name = "PrintLabel";
             this.PrintLabel.Size = new System.Drawing.Size(190, 26);
             this.PrintLabel.TabIndex = 185;
+            this.PrintLabel.SelectedIndexChanged += new System.EventHandler(this.PrintLabel_SelectedIndexChanged);
             this.PrintLabel.TextChanged += new System.EventHandler(this.PrintLabel_TextChanged);
             // 
             // label4
@@ -199,6 +200,7 @@
             this.pr_code.Str2 = null;
             this.pr_code.TabIndex = 191;
             this.pr_code.KeyDown += new System.Windows.Forms.KeyEventHandler(this.pr_code_KeyDown);
+            this.pr_code.Leave += new System.EventHandler(this.pr_code_Leave);
             // 
             // inputText
             // 
@@ -262,7 +264,9 @@
             this.Name = "Make_CustomLabelPrint";
             this.Tag = "Make!CustomLabelPrint";
             this.Text = "Make_CustomLabelPrint";
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Make_CustomLabelPrint_FormClosing);
             this.Load += new System.EventHandler(this.Make_CustomLablePrint_Load);
+            this.SizeChanged += new System.EventHandler(this.Make_CustomLabelPrint_SizeChanged);
             this.ResumeLayout(false);
             this.PerformLayout();
 

+ 61 - 25
UAS-MES/FunctionCode/Make/Make_CustomLabelPrint.cs

@@ -40,7 +40,7 @@ namespace UAS_MES.Make
 
         FileInfo info;
 
-        ftpOperater ftp;
+        //ftpOperater ftp;
 
         System.DateTime[] indate;
 
@@ -53,7 +53,7 @@ namespace UAS_MES.Make
         private void Make_CustomLablePrint_Load(object sender, EventArgs e)
         {
             dh = new DataHelper();
-            inputText.Focus();
+            pr_code.Focus();
             asc.controllInitializeSize(this);
             OperateResult.AppendText(">>请输入产品代码\n", Color.Black);
             InitPrint = new Thread(InPrint);
@@ -100,29 +100,15 @@ namespace UAS_MES.Make
                     //说明没有默认的模板,那就取pl_id最大的
                     listA = (DataTable)dh.ExecuteSql("select pl_labelcode ||':'||pl_labelname pl_name,pl_id,pl_labeltype,pl_labelcode,pl_labelurl,pl_isdefault,pl_detno,pl_labelsoft,pl_status,pl_statuscode,pl_labelname,pl_indate from  productlabel where pl_prodcode='" + pr_code.Text + "' and pl_labeltype='自定义' order by pl_id desc", "select");
                 }
+                //下载标签
+                getLabels();
                 //标签显示
                 PrintLabel.DataSource = listA;
                 PrintLabel.DisplayMember = "pl_name";
                 PrintLabel.ValueMember = "pl_labelcode";
-                //下载标签
-                getLabels();
                 //有值,填充界面
                 BaseUtil.SetFormValue(this.Controls, dt);
                 //paramsInfo = (DataTable)dh.ExecuteSql("select lp_detno, lp_name, lp_valuetype,lp_sql from label left join labelparameter on lp_laid=la_id where la_code='"+ listA.Rows[0]["pl_labelcode"].ToString() + "' order by lp_detno asc", "select");
-                if (paramsInfo.Rows.Count > 0)
-                {
-                    //根据查询出来的参数,一次提示用户, “<<SN001 “, 
-                    //“>> 请输入自定义模板的(XXXX参数名称)lp_name”
-                    OperateResult.AppendText("<<" + listA.Rows[0]["pl_labelcode"].ToString() + "\n", Color.Black);
-                    OperateResult.AppendText(">>请输入自定义模板参数名为:" + paramsInfo.Rows[0]["lp_name"].ToString() + "的值\n", Color.Green);
-                    //打开模板路径
-                    doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text.Split(':')[1]);
-                    currentIndex = 1;
-                }
-                else
-                {
-                    OperateResult.AppendText("<<标签编号:" + listA.Rows[0]["pl_labelcode"].ToString() + "无标签参数\n", Color.Red);
-                }
             }
         }
 
@@ -142,14 +128,16 @@ namespace UAS_MES.Make
                     OperateResult.AppendText("<<输入不能为空\n", Color.Red);
                     return;
                 }
+                OperateResult.AppendText(">>"+inputText.Text+"\n", Color.Black);
                 if (paramsInfo == null || paramsInfo.Rows.Count == 0)
                 {
-                    OperateResult.AppendText("<<未维护标签参数\n", Color.Red);
+                    OperateResult.AppendText("<<无可用标签\n", Color.Red,inputText);
+                    return;
                 }
                 else
                 {
                     if (doc==null) {
-                        OperateResult.AppendText(">>标签无效\n", Color.Red);
+                        OperateResult.AppendText(">>无可用标签\n", Color.Red,inputText);
                         return;
                     }
                     //将值赋到doc对应的变量
@@ -175,7 +163,7 @@ namespace UAS_MES.Make
                     }
                     if (currentIndex == paramsInfo.Rows.Count)
                     {
-                        OperateResult.AppendText("<<输入完成,正在打印\n", Color.Black);
+                        OperateResult.AppendText("<<输入完成,正在打印\n", Color.Black,inputText);
                         //打印
                         LogManager.DoLog(sb.ToString());
                         //保存本次赋值进行打印
@@ -190,12 +178,13 @@ namespace UAS_MES.Make
                         OperateResult.AppendText("<<打印成功\n", Color.Green);
                         //重置currenIndex为1
                         currentIndex = 1;
-                        OperateResult.AppendText(">>请输入自定义模板参数名为:" + paramsInfo.Rows[0]["lp_name"].ToString() + "的值\n", Color.Green);
+                        OperateResult.AppendText(">>请输入自定义模板的" + paramsInfo.Rows[0]["lp_name"].ToString() + "\n", Color.Black);
+                        doc=lbl.Documents.Open(ftpOperater.DownLoadTo + listA.Rows[PrintLabel.SelectedIndex]["pl_labelname"].ToString());
                     }
                     else
                     {
                         currentIndex++;
-                        OperateResult.AppendText("<<请输入模板参数名为:" + paramsInfo.Rows[currentIndex - 1]["lp_name"].ToString() + "的值\n", Color.Green);
+                        OperateResult.AppendText("<<请输入自定义模板的" + paramsInfo.Rows[currentIndex - 1]["lp_name"].ToString() + "\n", Color.Green,inputText);
                     }
                 }
             }
@@ -203,7 +192,7 @@ namespace UAS_MES.Make
 
         private void getLabels()
         {
-            ftp = new ftpOperater();
+            //ftp = new ftpOperater();
             indate = new System.DateTime[listA.Rows.Count];
             for (int i = 0; i < listA.Rows.Count; i++)
             {
@@ -214,7 +203,54 @@ namespace UAS_MES.Make
 
         private void PrintLabel_TextChanged(object sender, EventArgs e)
         {
-            paramsInfo = (DataTable)dh.ExecuteSql("select lp_detno, lp_name, lp_valuetype,lp_sql from label left join labelparameter on lp_laid=la_id where la_code='" + PrintLabel.SelectedValue.ToString() + "' order by lp_detno asc", "select");
+            if (PrintLabel.Text.StartsWith("System")) {
+                return;
+            }
+            paramsInfo = (DataTable)dh.ExecuteSql("select lp_detno, lp_name, lp_valuetype,lp_sql from label left join labelparameter on lp_laid=la_id where la_code='" + listA.Rows[PrintLabel.SelectedIndex]["pl_labelcode"].ToString() + "' order by lp_detno asc", "select");
+            if (paramsInfo.Rows.Count > 0)
+            {
+                //根据查询出来的参数,一次提示用户, “<<SN001 “, 
+                //“>> 请输入自定义模板的(XXXX参数名称)lp_name”
+                OperateResult.AppendText("<<" + listA.Rows[PrintLabel.SelectedIndex]["pl_labelcode"].ToString() + "\n", Color.Black);
+                OperateResult.AppendText(">>请输入自定义模板" + paramsInfo.Rows[0]["lp_name"].ToString() + "的值\n", Color.Green);
+                //打开模板路径
+                //doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.SelectedText.Split(':')[1]);
+                if (doc != null)
+                {
+                    doc.Close();
+                }
+                doc = lbl.Documents.Open(ftpOperater.DownLoadTo + listA.Rows[PrintLabel.SelectedIndex]["pl_labelname"].ToString());
+                currentIndex = 1;
+                //聚焦输入框
+                inputText.Focus();
+            }
+            else
+            {
+                OperateResult.AppendText("<<标签编号:" + listA.Rows[0]["pl_labelcode"].ToString() + "无标签参数\n", Color.Red);
+            }
+        }
+
+        private void Make_CustomLabelPrint_SizeChanged(object sender, EventArgs e)
+        {
+            asc.controlAutoSize(this);
+        }
+
+        private void PrintLabel_SelectedIndexChanged(object sender, EventArgs e)
+        {
+           
+        }
+
+        private void Make_CustomLabelPrint_FormClosing(object sender, FormClosingEventArgs e)
+        {
+            if (doc!=null)
+            {
+                doc.Close();
+            }
+        }
+
+        private void pr_code_Leave(object sender, EventArgs e)
+        {
+            pr_code_KeyDown(sender, new KeyEventArgs(Keys.Enter));
         }
     }
 }

+ 1 - 0
UAS-MES/FunctionCode/Make/Make_PackageCollection.Designer.cs

@@ -580,6 +580,7 @@
             this.SendCheck.AllPower = "ifall";
             this.SendCheck.BackColor = System.Drawing.Color.Transparent;
             this.SendCheck.DownImage = ((System.Drawing.Image)(resources.GetObject("SendCheck.DownImage")));
+            this.SendCheck.Enabled = false;
             this.SendCheck.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.SendCheck.Image = null;
             this.SendCheck.IsShowBorder = true;

+ 29 - 8
UAS_MesInterface/MESHelper.cs

@@ -5,7 +5,7 @@ using System.Data;
 using System.Runtime.InteropServices;
 using System.Text;
 
-namespace DllService
+namespace BenQGuru.eMES.DLLService
 {
 
     [Guid("99D0E96E-1058-415D-9874-D34537625284")]
@@ -23,6 +23,8 @@ namespace DllService
         bool SetIMEIInfo(string iSnCode, string iIMEI1, out string oErrMessage);
         bool GetMobileAllInfo(string iSnCode, 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);
         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);
     }
 
     [Guid("41EAB546-6EF4-464A-895A-9C34013A5D8C")]
@@ -381,7 +383,7 @@ namespace DllService
         private bool SetStepFinish(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, string iErrCode, out string oErrorMessage)
         {
             oErrorMessage = "";
-            string StepCode = getFieldDataByCondition("Makeserial", "ms_stepcode", "ms_sncode='" + iSN + "'").ToString();
+            string StepCode = getFieldDataByCondition("Makeserial", "ms_stepcode", "ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'").ToString();
             string CurrentStep = GetStepCodeBySource(iSourceCode);
             switch (iResult)
             {
@@ -401,20 +403,20 @@ namespace DllService
                         sql.Append(",mb_sourcecode,mb_badcode,mb_badtable,mb_soncode,mb_status) select makebad_seq.nextval");
                         sql.Append(",ma_code,ms_code,ms_sncode,'" + iUserCode + "',sysdate,'" + StepCode + "',ms_sourcecode,:bc_code,'',");
                         sql.Append("sp_soncode,'0' from make left join makeSerial on ms_makecode=ma_code left join stepProduct on ");
-                        sql.Append("sp_mothercode=ma_prodcode and sp_stepcode=ms_nextstepcode where ms_sncode='" + iSN + "'");
+                        sql.Append("sp_mothercode=ma_prodcode and sp_stepcode=ms_nextstepcode where ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'");
                         BatchInsert(sql.ToString(), new string[] { "bc_code" }, BadCode);
                         //将不良的序列号的状态码设为3
-                        ExecuteSql("update makeserial set ms_status='3' where ms_sncode=:sncode", "update", iSN);
+                        ExecuteSql("update makeserial set ms_status='3' where ms_sncode=:sncode and ms_makecode=:macode", "update", iSN, iMakeCode);
                     }
                     break;
                 default:
                     oErrorMessage = "测试结果必须为NG或者OK";
                     return false;
             }
-
+            //不良采集为良品是更新
             if (StepCode == CurrentStep && iResult == "OK")
             {
-                DataTable dt = getFieldsDataByCondition("makeserial", new string[] { "ms_status", "ms_craftcode", "ms_prodcode" }, "ms_sncode='" + iSN + "'");
+                DataTable dt = getFieldsDataByCondition("makeserial", new string[] { "ms_status", "ms_craftcode", "ms_prodcode" }, "ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'");
                 if (dt.Rows.Count > 0)
                 {
                     string ms_status = dt.Rows[0]["ms_status"].ToString();
@@ -423,8 +425,8 @@ namespace DllService
                     if (ms_status == "3")
                     {
                         string nextstepcode = getFieldDataByCondition("craft left join craftdetail on cr_id=cd_crid ", "cd_nextstepcode", "cr_code='" + ms_craftcode + "' and cr_prodcode='" + ms_prodcode + "' and cd_stepcode='" + CurrentStep + "'").ToString();
-                        UpdateByCondition("makeserial", "ms_status=1,ms_nextstepcode='" + nextstepcode + "'", "ms_sncode='" + iSN + "'");
-                        UpdateByCondition("makebad", "mb_status=-1", "mb_sncode='" + iSN + "'");
+                        UpdateByCondition("makeserial", "ms_status=1,ms_nextstepcode='" + nextstepcode + "'", "ms_sncode='" + iSN + "' and ms_makecode='"+iMakeCode+"'");
+                        UpdateByCondition("makebad", "mb_status=-1", "mb_sncode='" + iSN + "' and mb_makecode='"+iMakeCode+"'");
                     }
                 }
             }
@@ -903,5 +905,24 @@ namespace DllService
                 cmd.Connection.Open();
             }
         }
+
+        public bool SetPcbaData(string iSN, string iResCode, string iOperator, string iResult, string iErrCode, out string oErrMessage)
+        {
+            oErrMessage = "";
+            //SetMobileData();
+            return true;
+        }
+
+        public bool GoMo(string iMO, string iSN, string iResCode, out string oErrMessage)
+        {
+            oErrMessage = "";
+            string[] param = new string[] { iMO, iResCode, iSN, "", "", "", oErrMessage };
+            CallProcedure("CS_CHECKSTEPSNANDMACODE", ref param);
+            oErrMessage = param[6];
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                return true;
+            else
+                return false;
+        }
     }
 }