Ejemplo n.º 1
0
        /// <summary>
        /// 补bip allpart data
        /// </summary>
        public void TEST()
        {
            OleExec APDB   = new OleExec("HWD_APDB", false);
            string  strsql = @"select A.SN,B.PANEL from r_sn_station_detail A, R_PANEL_SN B where A.workorderno = '002510037542' and A.current_station = 'BIP'
                            AND A.SN = B.SN";
            DataSet ds     = SFCDB.ExecSelect(strsql);

            try
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    try
                    {
                        strsql = $@"SELECT p_sn FROM (
                            SELECT DISTINCT(p_sn) FROM MES4.R_TR_PRODUCT_DETAIL WHERE WO = '002510037542' AND P_SN LIKE '{ds.Tables[0].Rows[i]["PANEL"]}%') WHERE ROWNUM =1";
                        string panel_sn = APDB.ExecSelectOneValue(strsql)?.ToString();
                        if (panel_sn == null)
                        {
                            continue;
                        }
                        strsql = $@"UPDATE MES4.R_TR_PRODUCT_DETAIL SET P_SN='{ds.Tables[0].Rows[i]["SN"]}' WHERE p_SN='{panel_sn}'";
                        APDB.ExecSQL(strsql);
                    }
                    catch (Exception E)
                    {
                        throw E;
                    }
                    finally { }
                }
            }
            catch { }
            finally {
                APDB.CloseMe();
            }
        }