/// <summary>
 /// Конструктор для осуществления работы с необходимыми обработчиками
 /// </summary>
 /// <param name="check"></param>
 /// <param name="ccm"></param>
 /// <param name="som"></param>
 /// <param name="sship"></param>
 /// <param name="mat"></param>
 public NewMessageBuilder(IGlobalCheck check, ICCManagement ccm, ISOManagment som, IL4L3SerShipping sship, IMaterial mat)
 {
     this.check = check;
     this.ccm   = ccm;
     this.som   = som;
     this.sship = sship;
     this.mat   = mat;
 }
Example #2
0
        /// <summary>
        /// Получение аттрибутов
        /// </summary>
        /// <param name="tL4MsgInfoLine">Расширенная модель для обработки кода в линиях заказа</param>
        /// <param name="strProductType">Тип продукта</param>
        /// <param name="iSoID">ИД заказа</param>
        /// <param name="iSoLineID">ИД линии заказа</param>
        /// <param name="attrbSO">Сформированный лист аттрибутов заказа</param>
        /// <param name="strArrayOfAttributes">Лист аттрибутов</param>
        public void LoadAttrb(TL4MsgInfoLine tL4MsgInfoLine, string strProductType, int iSoID, int iSoLineID, TCheckRelatedList attrbSO = null, List <string> strArrayOfAttributes = null)
        {
            bool bTollerances = false;
            TCheckRealtedListRepo check;
            string strDecSep, sTmpAttrUnitID, sTmpAttrCode, sTmpAttrCodeL4;

            if (attrbSO == null)
            {
                check = new TCheckRealtedListRepo();
            }
            else
            {
                check = new TCheckRealtedListRepo(attrbSO);
            }
            if (strArrayOfAttributes == null)
            {
                strArrayOfAttributes = new List <string>();
            }
            string sqlstr = "SELECT ATTRB_CODE AS ATTRB_CODE,CONTR_EXT_KEY_FLD_NAME,UNIT_ID " +
                            "FROM ATTRB_CONTR_EXT_LINK " +
                            "WHERE ATTRB_REASON = 'L4_SOM' " +
                            "AND CONTR_EXT_KEY_FLD_NAME IN (" +
                            "SELECT COLUMN_NAME " +
                            "FROM USER_TAB_COLS " +
                            "WHERE TABLE_NAME = 'L4_L3_SO_LINE')";
            List <AttrbContrExtLink> extLink;

            using (OracleConnection connection = GetConnection())
            {
                extLink = connection.Query <AttrbContrExtLink>(sqlstr, null).AsList();
            }
            sqlstr = "select substr(value,1,1) as dec_separator " +
                     "from   nls_session_parameters " +
                     "where  PARAMETER = 'NLS_NUMERIC_CHARACTERS'";
            using (OracleConnection connection = BaseRepo.GetDBConnection())
            {
                strDecSep = connection.ExecuteScalar <string>(sqlstr, null);
            }
            foreach (AttrbContrExtLink attrb in extLink)
            {
                ACEandSoLine aceandSo = new ACEandSoLine();
                sTmpAttrCode   = attrb.attrbCode;
                sTmpAttrCodeL4 = attrb.contExtKeyName;
                sTmpAttrUnitID = attrb.unitId;
                sqlstr         = $"SELECT '{sTmpAttrCode}' AS ATTRB_CODE, " +
                                 $"ATTRIBUTE_TYPE AS ATTRB_FORMAT_CODE, " +
                                 $"DECODE (TO_CHAR(attribute_type)," +
                                 $"'ALPHA', DECODE( GET_AN_CONTROL_VALUE(EXT_NAME,1,attribute_value), 'NO TRANSALTION FOR ATTRIBUTE'," +
                                 $", 1, attribute_value), 'NO TRANSALTION FOR ATTRIBUTE'," +
                                 $"attribute_value, GET_AN_CONTROL_VALUE(EXT_NAME " +
                                 $", 1, attribute_value))" +
                                 $",'') AS attrb_an_value," +
                                 $"NVL (TO_NUMBER (DECODE (attribute_type, 'NUMERIC', attribute_value, 0)),0) AS attrb_num_value," +
                                 $"NVL (DECODE (TO_CHAR(attribute_type),'NUMERIC', DECODE(attrb_mu_code,NULL, TO_CHAR(attribute_value)," +
                                 $"DECODE ({sTmpAttrUnitID},{sTmpAttrUnitID},TO_CHAR(attribute_value),mual_converter (" +
                                 $"(SELECT interface_id " +
                                 $" FROM l3mu_interface_detail " +
                                 $" WHERE unit_id = {sTmpAttrUnitID} " +
                                 $"AND ROWNUM = 1)," +
                                 $"(SELECT quantity_id" +
                                 $"FROM l3mu_unit " +
                                 $"WHERE unit_id = {sTmpAttrUnitID}), " +
                                 $"(SELECT interface_id " +
                                 $"FROM l3mu_interface_detail " +
                                 $"WHERE unit_id = ATTRB_MU_CODE" +
                                 $"AND ROWNUM = 1), " +
                                 $"TO_CHAR(attribute_value) " +
                                 $"))), '0' ), '0'  ) AS attrb_num_mual_value, " +
                                 $"DECODE(TO_CHAR(ATTRIBUTE_TYPE), 'FLAG', TO_CHAR(ATTRIBUTE_VALUE), 'N' )  AS ATTRB_FLAG_VALUE, " +
                                 $"DECODE(TO_CHAR(ATTRIBUTE_TYPE), ''DATE'', TO_CHAR(ATTRIBUTE_VALUE), " +
                                 $"TO_DATE('01011970','DDMMYYYY') ) AS ATTRB_DATE_VALUE " +
                                 $"FROM   (SELECT TTL4.MSG_COUNTER, " +
                                 $"TTL4.SO_LINE_ID / 10, " +
                                 $"'{sTmpAttrCode}' AS ATTRIBUTE_CODE, " +
                                 $"ACE.ATTRB_FORMAT_CODE AS ATTRIBUTE_TYPE, " +
                                 $"ACE.ATTRB_EXTERN_NAME AS EXT_NAME, " +
                                 $"ACE.ATTRB_MU_CODE, " +
                                 $"NVL(ACE.ATTRB_DECIM_NUMB,2) AS ATTRB_DECIM_NUMB," +
                                 $"TTL4.{sTmpAttrCodeL4} AS ATTRIBUTE_VALUE" +
                                 $"from   L4_L3_SO_LINE TTL4, " +
                                 $"ATTRB_CATALOGUE_ENTITY ACE " +
                                 $"where '{sTmpAttrCode}'=ace.attrb_code " +
                                 $"and  (TTL4.SO_LINE_ID/10)  = {tL4MsgInfoLine.iSOLineID}" +
                                 $"and  TTL4.{sTmpAttrCodeL4} <> '-9999' " +
                                 $"and  TTL4.MSG_COUNTER  = {tL4MsgInfoLine.tL4MsgInfo.msgCounter} )";
                using (OracleConnection connection = GetConnection())
                {
                    aceandSo = connection.QueryFirstOrDefault <ACEandSoLine>(sqlstr, null);
                }
                if (aceandSo != null)
                {
                    strArrayOfAttributes.Add(aceandSo.attrbCode);
                    if (aceandSo.attrbCode == "THICK_PTOL" || aceandSo.attrbCode == "THICK_NTOL")
                    {
                        bTollerances = true;
                        check.Add("THICK_TOL_CODE", "MANUAL");
                    }
                    if (aceandSo.attrbCode == "PRODUCT_QUALITY_CODE")
                    {
                        switch (Convert.ToInt32(aceandSo.attrbAnValue))
                        {
                        case 1:
                            check.Add(aceandSo.attrbCode, "PRIME");
                            break;

                        case 2:
                            check.Add(aceandSo.attrbCode, "SECONDARY");
                            break;
                        }
                    }
                    else if (aceandSo.attrbCode == "EDGE_CONDITION_CODE")
                    {
                        if (aceandSo.attrbAnValue == "О")
                        {
                            check.Add(aceandSo.attrbCode, "TRIM");
                        }
                        else if (aceandSo.attrbAnValue == "НО")
                        {
                            check.Add(aceandSo.attrbCode, "MILL");
                        }
                    }
                    else if (aceandSo.attrbCode == "PRODUCT_TYPE")
                    {
                        check.Add(aceandSo.attrbCode, strProductType);
                    }
                    else
                    {
                        //switch(AttrFor)
                        //{
                        throw new NotImplementedException();
                        //}
                    }
                }
            }
        }