Browse Source

支持打印带出标签

callm 4 months ago
parent
commit
92b1a1d502

+ 28 - 0
UAS_MES_ODLF/DataOperate/DataHelper.cs

@@ -47,6 +47,34 @@ namespace UAS_MES_NEW.DataOperate
             command.Dispose();
             return dt;
         }
+        public void CallProcedure(string ProcedureName, string[] ParamName, ref string[] param)
+        {
+            command = new OracleCommand(ProcedureName);
+            command.Connection = connection;
+            Reconnect(command);
+            command.CommandText = ProcedureName;
+            command.CommandType = CommandType.StoredProcedure;
+            for (int i = 0; i < param.Length; i++)
+            {
+                command.Parameters.Add(new OracleParameter(ParamName[i], OracleDbType.Varchar2, 200, param[i], ParameterDirection.InputOutput));
+                //command.Parameters.Add(new OracleParameter(ParamName[i], OracleType.VarChar, 200, ParameterDirection.InputOutput, "", DataRowVersion.Default, true, param[i]));
+            }
+            try
+            {
+                command.ExecuteNonQuery();
+            }
+            catch (Exception)
+            {
+                command.Connection = new OracleConnection(ConnectionStrings);
+                command.Connection.Open();
+                command.ExecuteNonQuery();
+            }
+            for (int i = 0; i < command.Parameters.Count; i++)
+                param[i] = command.Parameters[i].Value.ToString();
+
+        }
+
+
 
         /// <summary>
         /// 获取第一行第一列的信息

+ 9 - 4
UAS_MES_ODLF/FunctionCode/Make/Make_FuselageLabelPrintGetIMEI.cs

@@ -192,9 +192,14 @@ namespace UAS_MES_NEW.Make
                                 OperateResult.AppendText(">>" + oErrorMessage + "\n", Color.Red);
                                 return;
                             };
-                            string PSN = "";
-                            LogicHandler.GetPSN(oMsId, out PSN);
-                            //dh.ExecuteSql("update makeserial set ms_sncode='" + oPSN + "',ms_firstsn='" + oPSN + "',ms_tsn='" + sncode.Text + "' where ms_id='" + oMsId + "' ", "update");
+                            if (!LogicHandler.SetIMEIInfo(sncode.Text, oIMEI1 == "null" ? "" : oIMEI1, oIMEI2 == "null" ? "" : oIMEI2, "", oMEID == "null" ? "" : oMEID, oNetcode == "null" ? "" : oNetcode, oID1 == "null" ? "" : oID1, oID2 == "null" ? "" : oID2, oID3 == "null" ? "" : oID3, out oErrorMessage))
+                            {
+                                OperateResult.AppendText(">>" + oErrorMessage + "\n", Color.Red);
+                                return;
+                            }
+                            //string PSN = "";
+                            //LogicHandler.GetPSN(oMsId, out PSN);
+                            dh.ExecuteSql("update makeserial set ms_sncode='" + oPSN + "',ms_firstsn='" + oPSN + "',ms_tsn='" + sncode.Text + "' where ms_id='" + oMsId + "' ", "update");
                             //string oBT = "";
                             //string oWifi = "";
                             //string oCode1 = "";
@@ -216,7 +221,7 @@ namespace UAS_MES_NEW.Make
                             //记录日志
                             LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "机身标打印", "机身标打印成功", sncode.Text, "");
                             //更新打印的数据
-                            if (LogicHandler.SetStepResult(ma_code.Text, User.UserSourceCode, sncode.Text, "机身标打印", "机身标打印成功", User.UserCode, out oErrorMessage))
+                            if (LogicHandler.SetStepResult(ma_code.Text, User.UserSourceCode, oPSN, "机身标打印", "机身标打印成功", User.UserCode, out oErrorMessage))
                             {
                                 //提示正确返回时传递的信息
                                 if (oErrorMessage.Contains("AFTERSUCCESS"))

+ 2 - 2
UAS_MES_ODLF/FunctionCode/Make/Make_TestCollection.Designer.cs

@@ -887,10 +887,10 @@
             this.Load += new System.EventHandler(this.TestCollection_Load);
             this.SizeChanged += new System.EventHandler(this.测试采集_SizeChanged);
             this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Make_TestCollection_KeyDown);
-            this.panel1.ResumeLayout(false);
+            this.panel1.ResumeLayout(true);
             this.panel1.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.BadInfSource)).EndInit();
-            this.ResumeLayout(false);
+            this.ResumeLayout(true);
             this.PerformLayout();
 
         }

+ 77 - 2
UAS_MES_ODLF/FunctionCode/Make/Make_TestCollection.cs

@@ -183,13 +183,88 @@ namespace UAS_MES_NEW.Make
                 ChoosedList.Clear();
                 if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
                 {
-                    
-                    SetCollectResult();
+                    dt = (DataTable)dh.ExecuteSql("select ms_sncode from makeserial where ms_imei1='" + ms_sncode.Text + "' order by ms_id desc", "select");
+                    if (dt.Rows.Count > 0)
+                    {
+                        ms_sncode.Text = dt.Rows[0]["ms_sncode"].ToString();
+                    }
+                    else
+                    {
+                        dt = (DataTable)dh.ExecuteSql("select ms_sncode from makeserial where ms_imei2='" + ms_sncode.Text + "' order by ms_id desc", "select");
+                        if (dt.Rows.Count > 0)
+                        {
+                            ms_sncode.Text = dt.Rows[0]["ms_sncode"].ToString();
+                        }
+                        else
+                        {
+                            dt = (DataTable)dh.ExecuteSql("select mil_sncode from makeimeilist where mil_imei1='" + ms_sncode.Text + "' order by mil_id desc", "select");
+                            if (dt.Rows.Count > 0)
+                            {
+                                ms_sncode.Text = dt.Rows[0]["mil_sncode"].ToString();
+                            }
+                            else
+                            {
+                                dt = (DataTable)dh.ExecuteSql("select mil_sncode from makeimeilist where mil_imei2='" + ms_sncode.Text + "' order by mil_id desc", "select");
+                                if (dt.Rows.Count > 0)
+                                {
+                                    ms_sncode.Text = dt.Rows[0]["mil_sncode"].ToString();
+                                }
+                            }
+                        }
+                    }
+                    if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, ms_sncode.Text, User.UserCode, out oMakeCode, out oMSID, out ErrorMessage))
+                    {
+                        //是否提示过工单切换框,检测前后执行
+                      
+                        if (ma_code.Text != oMakeCode && oMakeCode != null)
+                        {
+                            dt = (DataTable)dh.ExecuteSql("select ma_code,ma_prodcode,ma_softversion,ma_salecode,pr_spec,nvl(pr_sendchecktype,'LineCode')pr_sendchecktype,ma_qty from make left join product on ma_prodcode=pr_code where ma_code='" + oMakeCode + "'", "select");
+                            if (dt.Rows.Count > 0)
+                            {
+                                BaseUtil.SetFormValue(this.Controls, dt);
+                                LockMakeCode.Checked = true;
+                            }
+                        }
+                        dt = (DataTable)dh.ExecuteSql("select ms_nextstepcode,ms_sncode,ms_reworkstatus,nvl(ms_ifrework,0)ms_ifrework,ms_stepcode,ms_status,nvl(st_ifrepair,0) st_ifrepair from makeserial left join step on ms_stepcode=st_code where ms_id='" + oMSID + "'", "select");
+                        string status = dt.Rows[0]["ms_status"].ToString();
+                        reworkstatus = dt.Rows[0]["ms_reworkstatus"].ToString();
+                        string stepcode = dt.Rows[0]["ms_stepcode"].ToString();
+                        string ifrepair = dt.Rows[0]["st_ifrepair"].ToString();
+                        string sncode = dt.Rows[0]["ms_sncode"].ToString();
+                        if (sncode != ms_sncode.Text)
+                        {
+                            OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过转号,不允许使用TSN采集\n", Color.Red, ms_sncode);
+                            return;
+                        }
+                        ifrework = dt.Rows[0]["ms_ifrework"].ToString();
+                        if (GoodProduct.Checked)
+                        {
+                            if (ifrework != "0")
+                            {
+                                if (stepcode == User.CurrentStepCode && (reworkstatus == "1" || reworkstatus == "2") && ifrepair == "0")
+                                {
+                                    OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过" + User.CurrentStepCode + "工序,采集结果为良品\n", Color.Red, ms_sncode);
+                                    return;
+                                }
+                            }
+                            else
+                            {
+                                if (stepcode == User.CurrentStepCode && (status == "1" || status == "2") && ifrepair == "0")
+                                {
+                                    OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过" + User.CurrentStepCode + "工序,采集结果为良品\n", Color.Red, ms_sncode);
+                                    return;
+                                }
+                            }
+                        }
+                        SetCollectResult();
+                    }
+                    else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
                 }
                 else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
             }
         }
 
+
         private void bc_groupcode_SelectedIndexChanged(object sender, EventArgs e)
         {
             LoadBadCodeListView();

+ 126 - 2
UAS_MES_ODLF/PublicMethod/LogicHandler.cs

@@ -1,7 +1,10 @@
-using System;
+using DevExpress.XtraPrinting.Native;
+using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Data;
 using System.Drawing;
+using System.Security.Cryptography;
 using System.Text;
 using System.Windows;
 using System.Windows.Forms;
@@ -39,6 +42,127 @@ namespace UAS_MES_NEW.PublicMethod
             dh.ExecuteSql(sql.ToString(), "insert");
         }
 
+
+        public static bool GetPSN(string iSN, out string oPSN)
+        {
+            oPSN = "";
+            string[] param = new string[] { iSN, oPSN };
+            string[] ParamName = new string[] { "v_i_sncode", "v_o_psn" };
+            dh.CallProcedure("GETPSN_RULE", ParamName, ref param);
+            oPSN = param[1];
+            return true;
+        }
+
+        [Description("分配IMEI和NetCode信息")]
+        public static bool GetMEIOrNetCodeRange(string iSN, string iMacode, 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 oErrMessage)
+        {
+            oIMEI1 = "";
+            oIMEI2 = "";
+            oMEID = "";
+            oNetCode = "";
+            oPSN = "";
+            oID1 = "";
+            oID2 = "";
+            oID3 = "";
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            string[] param = new string[] { iSN, iMacode, 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" };
+            dh.CallProcedure("CS_GETIMEIORNETCODERANGE_TEST", ParamName, ref param);
+            oIMEI1 = param[4];
+            oIMEI2 = param[5];
+            oMEID = param[7];
+            oNetCode = param[8];
+            oPSN = param[9];
+            oID1 = param[10];
+            oID2 = param[11];
+            oID3 = param[12];
+            oErrMessage = param[13];
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                return true;
+            else
+                return false;
+        }
+
+
+        public static bool SetIMEIInfo(string iSN, string iIMEI1, string iIMEI2, string iIMEI3, string iMEID, string iNETCODE, string iID1, string iID2, string iID3, out string oErrMessage)
+        {
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            string[] param = new string[] { iSN, iIMEI1, iIMEI2, iIMEI3, iMEID, iNETCODE, "", iID1, iID2, iID3, 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" };
+            dh.CallProcedure("CS_SETIMEIINFO", ParamName, ref param);
+            oErrMessage = param[10];
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                return true;
+            else
+                return false;
+        }
+
+        [Description("分配MAC和BT信息")]
+        public static bool GetAddressRangeByMO(string iSN, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCdoe3, out string oErrMessage)
+        {
+            oWIFI = "";
+            oBT = "";
+            oCode1 = "";
+            oCode2 = "";
+            oCdoe3 = "";
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            string omakeCode = "";
+            GetRcardMOInfo(iSN, out omakeCode, out oErrMessage);
+            string[] param = new string[] { iSN, omakeCode, oWIFI, oBT, oCode1, oCode2, oCdoe3, oErrMessage };
+            string[] ParamName = new string[] { "v_i_sncode", "v_i_macode", "v_o_mac", "v_o_bt", "v_o_code1", "v_o_code2", "v_o_code3", "v_o_errmsg" };
+            dh.CallProcedure("CS_GETADDRESSBYMAKECODE_TEST", ParamName, ref param);
+            oWIFI = param[2];
+            oBT = param[3];
+            oCode1 = param[4];
+            oCode2 = param[5];
+            oCdoe3 = param[6];
+            oErrMessage = param[7];
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                return true;
+            else
+                return false;
+        }
+
+        public static bool GetRcardMOInfo(string iSN, out string oMoCode, out string oErrMessage)
+        {
+            //取MakeProcess表中的执行记录ID最大的一个工单的号码
+            oMoCode = "";
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            sql.Clear();
+            sql.Append("select max(ms_id) from makeserial where ms_sncode in (select '" + iSN + "' from dual union select sn from ");
+            sql.Append("makesnrelation where beforesn='" + iSN + "' and sn<>' '  union select beforesn from makesnrelation where sn='" + iSN + "' and beforesn<>' ')");
+            DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+            string ms_id = dt.Rows[0][0].ToString();
+            oMoCode = dh.getFieldDataByCondition("MakeSerial", "ms_makecode", "ms_id='" + ms_id + "'").ToString();
+            if (oMoCode != "")
+                return true;
+            else
+            {
+                oErrMessage = "序列号:" + iSN + " 未归属工单";
+                return false;
+            }
+        }
+
         /// <summary>
         /// 判断工单是否已经下放
         /// </summary>
@@ -1405,7 +1529,7 @@ namespace UAS_MES_NEW.PublicMethod
         /// <param name="stepcode"></param>
         /// <param name="ifRePrint"></param>
         /// <param name="userCode"></param>
-        public static void doLabelPrintLog(string printValue, string printType, string MakeCode, string prodCode, string sourceCode, string stepcode, string ifRePrint, string userCode,string filename)
+        public static void doLabelPrintLog(string printValue, string printType, string MakeCode, string prodCode, string sourceCode, string stepcode, string ifRePrint, string userCode, string filename)
         {
             sql.Clear();
             sql.Append("insert into labelprintlog(LPL_ID,LPL_VALUE,LPL_TYPE,LPL_MAKECODE,LPL_PRODCODE,LPL_SOURCECODE,LPL_STEPCODE,LPL_IFREPRINT,LPL_INDATE,LPL_INMAN,lpl_file) ");

+ 9 - 0
UAS_MES_ODLF/UAS_MES_ODLF.csproj

@@ -565,6 +565,12 @@
     <Compile Include="FunctionCode\Make\Make_FeedingCollectionCombine.Designer.cs">
       <DependentUpon>Make_FeedingCollectionCombine.cs</DependentUpon>
     </Compile>
+    <Compile Include="FunctionCode\Make\Make_FuselageLabelPrintGetIMEI.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="FunctionCode\Make\Make_FuselageLabelPrintGetIMEI.Designer.cs">
+      <DependentUpon>Make_FuselageLabelPrintGetIMEI.cs</DependentUpon>
+    </Compile>
     <Compile Include="FunctionCode\Make\Make_ImeiCheck_IMEI.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -1360,6 +1366,9 @@
     <EmbeddedResource Include="FunctionCode\Make\Make_FeedingCollectionCombine.resx">
       <DependentUpon>Make_FeedingCollectionCombine.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="FunctionCode\Make\Make_FuselageLabelPrintGetIMEI.resx">
+      <DependentUpon>Make_FuselageLabelPrintGetIMEI.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="FunctionCode\Make\Make_ImeiCheck_IMEI.resx">
       <DependentUpon>Make_ImeiCheck_IMEI.cs</DependentUpon>
     </EmbeddedResource>