Exemplo n.º 1
0
        public static IList <IPO> GetNextPO(long value, POValueType valueType, int facilityNumber = 960)
        {
            List <IPO> poList = new List <IPO>();

            string whereClause = string.Empty;

            switch (valueType)
            {
            case POValueType.VBU_UNKNOWN:
            case POValueType.HOVBU:
                long vbu = GetSFVBU(value, facilityNumber);
                value = vbu == -1? value : vbu;
                goto case POValueType.SFVBU;

            case POValueType.PO:
                PO tempPO = new PO(value);
                value = tempPO.ShipFromVBU;
                goto case POValueType.SFVBU;

            case POValueType.SFVBU:
                whereClause = "(((LOWES.W001_PO_DAL_HDR.T063_LCT_NBR)={1}) " +
                              "AND ((LOWES.W001_PO_DAL_HDR.RCP_CD_TXT)='N') " +
                              "AND ((LOWES.W001_PO_DAL_HDR.P028_VND_NBR)={0}) " +
                              "AND ((LOWES.W002_PO_DAL_DTL.RCV_QTY)=0))";
                break;

            case POValueType.ITEM:

                whereClause = "(((LOWES.W002_PO_DAL_DTL.T063_LCT_NBR)={1}) " +
                              "AND LOWES.W002_PO_DAL_DTL.RCV_QTY = 0 " +
                              "AND ((LOWES.W002_PO_DAL_DTL.T024_ITM_NBR)={0}) " +
                              "AND ((LOWES.W001_PO_DAL_HDR.RCP_CD_TXT)='N'))";
                break;

            default:
                break;
            }

            whereClause = string.Format(whereClause, value, facilityNumber);
            ADODB.Recordset rs = HostConnection.GetInstance().Recordset(string.Format(Properties.Resources.GetNextAvailPO, whereClause));

            if (!(rs.BOF && rs.EOF))
            {
                poList = rs.GetPOsFromList().ToList();

                rs.Close();
                rs = null;
            }
            return(poList);
        }
Exemplo n.º 2
0
        private static long GetSFVBU(long HOVBU, int facilityNumber)
        {
            string sql = Properties.Resources.FindSFVBU;

            sql = string.Format(sql, HOVBU, facilityNumber);

            ADODB.Recordset rs = HostConnection.GetInstance().Recordset(sql);

            if (rs.BOF && rs.EOF)
            {
                return(-1);
            }

            long VBU = (long)rs.Fields[0].Value;

            rs.Close();
            rs = null;

            return(VBU);
        }
Exemplo n.º 3
0
        private string GetDescription()
        {
            string sql = string.Empty;

            ADODB.Recordset rs;

            switch (ItemTypeID)
            {
            case 1:
                if (DMSConnection.GetInstance().Connection != null)
                {
                    sql = "SELECT itm_desc FROM dbo.item WHERE itm_num=" + Value;
                }
                else if (HostConnection.GetInstance().Connection != null)
                {
                    sql = "SELECT ITM_DES_TXT FROM Lowes.T024_ITM WHERE T024_ITM_NBR=" + Value;
                }
                break;

            case 2:
                if (DMSConnection.GetInstance().Connection != null)
                {
                    sql = "SELECT vnd_nme FROM dbo.e537a_rcv_hdr WHERE e058_po_nbr =" + Value;
                }
                else if (HostConnection.GetInstance().Connection != null)
                {
                    sql = "SELECT VND_NME FROM Lowes.W001_PO_DAL_HDR WHERE E058_PO_NBR=" + Value;
                }
                break;

            case 3:
                Facility fac = new Facility().Where("fac_num=" + Value).SingleOrDefault();
                return(fac == null ? string.Empty : fac.Name);

            case 4:
                string retVal = "Unknown vendor.";

                if (HostConnection.GetInstance().Connection != null)
                {
                    sql = "SELECT VBU_NME FROM LOWES.T616_VBU WHERE T616_VBU_NBR=" + Value + " AND T617_FNC_TYP_CD=1";
                    try
                    {
                        retVal = HostConnection.GetInstance().Recordset(sql).Fields[0].Value.ToString();
                    }
                    catch (Exception) { retVal = "Unknown Vendor."; }
                }
                return(retVal);

            default:
                return("Unknown.");
            }

            if (DMSConnection.GetInstance().Connection != null)
            {
                rs = DMSConnection.GetInstance().Recordset(sql);
            }
            else
            {
                rs = HostConnection.GetInstance().Recordset(sql);
            }

            string output;

            try
            {
                if (!(rs.BOF && rs.EOF))
                {
                    output = rs.Fields[0].Value.ToString();
                }
                else
                {
                    output = "Unknown.";
                }
            }
            catch (Exception) { output = "Unknown error occured."; }
            rs.Close();
            rs = null;
            //string output = "Not implimented yet.";
            return(output);
        }