• Enterprise library设用存储过程的实例,国药RF系统中间类


    using System;
    using System.Collections.Generic;
    using System.Web;
    using System.Data;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Microsoft.Practices.EnterpriseLibrary.Data;
    using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
    using System.Data.Common;
    using System.Web.SessionState;
    using System.Collections;
    using System.ComponentModel;
    using System.Drawing;
    using System.Web.UI.HtmlControls;
    using System.Text.RegularExpressions;
    using System.Text;
    using System.Configuration;
    using System.Data.SqlClient;
    using System.Net;
    using System.Web.Mobile;
    using System.Web.UI.MobileControls;
    using System.Runtime.InteropServices;
    namespace RFRC
    {
        public class RFServices
        {
            [DllImport("Iphlpapi.dll")]
            private static extern int SendARP(Int32 dest, Int32 host, ref Int32 mac, ref Int32 length);
            [DllImport("Ws2_32.dll")]
            private static extern Int32 inet_addr(string ip); 

            public static string SUNRFRC = "defauleDB";
            public RFServices()
            {
                //得到数据库连接
            }

            public string GetStringList(string ExecuteSql)
            {
                Database db = DatabaseFactory.CreateDatabase(SUNRFRC);

                string sqlCommand = ExecuteSql;
                DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);

                StringBuilder readerData = new StringBuilder();
                using (IDataReader dataReader = db.ExecuteReader(dbCommand))
                {
                    // Iterate through DataReader and put results to the text box.
                    // DataReaders cannot be bound to Windows Form controls (e.g. the
                    // resultsDataGrid), but may be bound to Web Form controls.
                    while (dataReader.Read())
                    {
                        // Get the value of the 'Name' column in the DataReader
                        readerData.Append(dataReader["Name"]);
                        readerData.Append(Environment.NewLine);
                    }
                }

                return readerData.ToString();
            }
            //事例,利用存储过程得到产品
            public DataSet GetProductsInCategory(int Category)
            {
                Database db = DatabaseFactory.CreateDatabase(SUNRFRC);

                string sqlCommand = "GetProductsByCategory";
                DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

                db.AddInParameter(dbCommand, "CategoryID", DbType.Int32, Category);
     
                DataSet productsDataSet = null;

                productsDataSet = db.ExecuteDataSet(dbCommand);
                return productsDataSet;
               
            }
            //用户登陆检查
            public static string CheckLogin(string sUserName, string sPassword)
            {
                Database db = DatabaseFactory.CreateDatabase(SUNRFRC);

                string sqlCommand = "PDA_CheckLogin";
                DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

                db.AddInParameter(dbCommand, "asUserName", DbType.String, sUserName);
                db.AddInParameter(dbCommand, "Psw", DbType.String, sPassword);
                try
                {
                    using (IDataReader dr = db.ExecuteReader(dbCommand))
                    {

                        //记录用户信息
                        string UserName = "ERROR";
                        //UserID,UserName,UserPassword,UserChineseName,Department
                        if (dr.Read())
                        {
                            UserName = dr[0].ToString();
                            if (UserName != "ERROR")
                            {
                                string SuccessResult = dr[1].ToString() + "," + UserName + "," + dr[2].ToString() + "," + dr[3].ToString();
                                return SuccessResult;
                            }
                            else
                                return "ERROR";
                        }
                        else
                            return "ERROR";

                    }
                }
                catch (Exception ee)
                {
                    return "ERROR:"+ee.Message;
                }

            }
            //得到产品目录
            public static DataSet GetProductsInQueryCode(string sQueryType,string sQueryCode)//如拼音,条码得到产品目录
            {
                Database db = DatabaseFactory.CreateDatabase(SUNRFRC);

                string sqlCommand = "PDA_GetProducts";
                DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

                db.AddInParameter(dbCommand, "QueryType", DbType.String, sQueryType);
                db.AddInParameter(dbCommand, "QueryCode", DbType.String, sQueryCode);
                //注意点,如果是oracle,可以不定义游标参数,但游标名称必须是cur_OUT  out sys_refcursor
                DataSet productsDataSet = null;

                productsDataSet = db.ExecuteDataSet(dbCommand);
                return productsDataSet;
            }
            //crmruntime
            public static int crmruntime()
            {
                return 1;
            }
            //得到特定类别
            public static void GetTypeByFunction(string sFunction,string sEmpCode,SelectionList ddl)
            {
                Database db = DatabaseFactory.CreateDatabase(SUNRFRC);

                string sqlCommand = "PDA_GetType";
                DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

                db.AddInParameter(dbCommand, "asFunction", DbType.String, sFunction);
                db.AddInParameter(dbCommand, "asEmpCode", DbType.String, sEmpCode);
                //注意点,如果是oracle,可以不定义游标参数,但游标名称必须是cur_OUT
                DataSet ds = null;

                ds = db.ExecuteDataSet(dbCommand);
                ddl.DataTextField = "typeName";
                ddl.DataValueField = "typeID";

                ddl.DataSource = ds;
                ddl.DataBind();
            }
       
            //从采购记录中取得验收记录
            public static DataSet GetDrugAcceptance(string sRecordNO,string sBarCode,string sPH)
            {

                Database db = DatabaseFactory.CreateDatabase(SUNRFRC);

                string sqlCommand = "PDA_GetDrugAcceptance";
                DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

                db.AddInParameter(dbCommand, "RecordNO", DbType.String, sRecordNO);
                db.AddInParameter(dbCommand, "BarCode", DbType.String, sBarCode);
                db.AddInParameter(dbCommand, "PH", DbType.String, sPH);
                //注意点,如果是oracle,可以不定义游标参数,但游标名称必须是cur_OUT
                DataSet ds = null;

                ds = db.ExecuteDataSet(dbCommand);
                return ds;
            }
            //得到销售记录
            public static DataSet GetSaleRecord(string sRecordNO, string sBarCode,string sBachNumber)
            {

                Database db = DatabaseFactory.CreateDatabase(SUNRFRC);

                string sqlCommand = "PDA_GetSaleRecord";
                DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

                db.AddInParameter(dbCommand, "RecordNO", DbType.String, sRecordNO);
                db.AddInParameter(dbCommand, "BarCode", DbType.String, sBarCode);
                db.AddInParameter(dbCommand, "BachNumber", DbType.String, sBachNumber);
                //注意点,如果是oracle,可以不定义游标参数,但游标名称必须是cur_OUT
                DataSet ds = null;

                ds = db.ExecuteDataSet(dbCommand);
                return ds;
            }
            //PDA_CheckKiaf判断是否是特殊药品,判断是否特殊药品10为是,00为否
            public static bool PDA_CheckKiaf(decimal GoodsID)
            {
                Database db = DatabaseFactory.CreateDatabase(SUNRFRC);

                string sqlCommand = "PDA_CheckKiaf";
                DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
                db.AddInParameter(dbCommand, "goodid", DbType.Decimal, GoodsID);
                db.AddOutParameter(dbCommand, "DrugStatus", DbType.String, 500);
                //注意点,如果是oracle,可以不定义游标参数,但游标名称必须是cur_OUT
                string RetInfo = "";

                db.ExecuteNonQuery(dbCommand);
                //得到返回参数
                RetInfo = db.GetParameterValue(dbCommand, "DrugStatus").ToString();

                if (RetInfo == "10")
                    return true;
                else
                    return false;

            }
            //得到养库和盘点的记录
            public static DataSet GetConserAndStockRecord(string sBarCode, string sBachNumber)
            {

                Database db = DatabaseFactory.CreateDatabase(SUNRFRC);

                string sqlCommand = "PDA_GetConserAndStockRecord";
                DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
                db.AddInParameter(dbCommand, "BarCode", DbType.String, sBarCode);
                db.AddInParameter(dbCommand, "BachNumber", DbType.String, sBachNumber);
                //注意点,如果是oracle,可以不定义游标参数,但游标名称必须是cur_OUT
                DataSet ds = null;

                ds = db.ExecuteDataSet(dbCommand);
                return ds;
            }
            //插入验收记录
            public static string PDA_Insert_PDA_DrugAcceptance(string RecordNO, string BarCode, string ProductID, string DrugName, string DrugSpec, string DrugUnit, string Manufacturer, string DrugApprovalNumber, string SupplierID, string SupplierName, string ExpiryDate, string BatchNumber, int CodePages, decimal Amount, string Pack, string Verdict, string AcceptMan, DateTime AcceptDate,string ServiceType)
            {
                Database db = DatabaseFactory.CreateDatabase(SUNRFRC);

                string sqlCommand = "PDA_Insert_PDA_DrugAcceptance";
                DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
                 db.AddInParameter(dbCommand, "sRecordNO", DbType.String, RecordNO);
                 db.AddInParameter(dbCommand, "sBarCode", DbType.String, BarCode);
                 db.AddInParameter(dbCommand, "sProductID", DbType.String, ProductID);
                 db.AddInParameter(dbCommand, "sDrugName", DbType.String, DrugName);
                 db.AddInParameter(dbCommand, "sDrugSpec", DbType.String, DrugSpec);
                 db.AddInParameter(dbCommand, "sDrugUnit", DbType.String, DrugUnit);
                 db.AddInParameter(dbCommand, "sManufacturer", DbType.String, Manufacturer);
                 db.AddInParameter(dbCommand, "sDrugApprovalNumber", DbType.String, DrugApprovalNumber);
                 db.AddInParameter(dbCommand, "sSupplierID", DbType.String, SupplierID);
                 db.AddInParameter(dbCommand, "sSupplierName", DbType.String, SupplierName);
                 db.AddInParameter(dbCommand, "sExpiryDate", DbType.String, ExpiryDate);
                 db.AddInParameter(dbCommand, "sBatchNumber", DbType.String, BatchNumber);
                 db.AddInParameter(dbCommand, "sCodePages", DbType.Decimal, CodePages);
                 db.AddInParameter(dbCommand, "sAmount", DbType.Decimal, Amount);
                 db.AddInParameter(dbCommand, "sPack", DbType.String, Pack);
                 db.AddInParameter(dbCommand, "sVerdict", DbType.String, Verdict);
                 db.AddInParameter(dbCommand, "sAcceptMan", DbType.String, AcceptMan);
                 db.AddInParameter(dbCommand, "sAcceptDate", DbType.Date, AcceptDate.Date);
                 db.AddInParameter(dbCommand, "sServiceType", DbType.String, ServiceType);
                //输出参数
                 db.AddOutParameter(dbCommand, "sRetInfo", DbType.String, 500);
                //注意点,如果是oracle,可以不定义游标参数,但游标名称必须是cur_OUT
                 string RetInfo = "";

                db.ExecuteNonQuery(dbCommand);
                //得到返回参数
                RetInfo = db.GetParameterValue(dbCommand, "sRetInfo").ToString();

                return RetInfo;
            }
            public static string PDA_Insert_PDA_DrugAcceptance(string RecordNO, string BarCode, string ProductID, string DrugName, string DrugSpec, string DrugUnit, string Manufacturer, string DrugApprovalNumber, string SupplierID, string SupplierName, string ExpiryDate, string BatchNumber, int CodePages, decimal Amount, string Pack, string Verdict, string AcceptMan, DateTime AcceptDate, string ServiceType, string sRECEIVERCODE2)
            {
                Database db = DatabaseFactory.CreateDatabase(SUNRFRC);

                string sqlCommand = "PDA_Insert_PDA_DrugAcceptance";
                DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
                db.AddInParameter(dbCommand, "sRecordNO", DbType.String, RecordNO);
                db.AddInParameter(dbCommand, "sBarCode", DbType.String, BarCode);
                db.AddInParameter(dbCommand, "sProductID", DbType.String, ProductID);
                db.AddInParameter(dbCommand, "sDrugName", DbType.String, DrugName);
                db.AddInParameter(dbCommand, "sDrugSpec", DbType.String, DrugSpec);
                db.AddInParameter(dbCommand, "sDrugUnit", DbType.String, DrugUnit);
                db.AddInParameter(dbCommand, "sManufacturer", DbType.String, Manufacturer);
                db.AddInParameter(dbCommand, "sDrugApprovalNumber", DbType.String, DrugApprovalNumber);
                db.AddInParameter(dbCommand, "sSupplierID", DbType.String, SupplierID);
                db.AddInParameter(dbCommand, "sSupplierName", DbType.String, SupplierName);
                db.AddInParameter(dbCommand, "sExpiryDate", DbType.String, ExpiryDate);
                db.AddInParameter(dbCommand, "sBatchNumber", DbType.String, BatchNumber);
                db.AddInParameter(dbCommand, "sCodePages", DbType.Decimal, CodePages);
                db.AddInParameter(dbCommand, "sAmount", DbType.Decimal, Amount);
                db.AddInParameter(dbCommand, "sPack", DbType.String, Pack);
                db.AddInParameter(dbCommand, "sVerdict", DbType.String, Verdict);
                db.AddInParameter(dbCommand, "sAcceptMan", DbType.String, AcceptMan);
                db.AddInParameter(dbCommand, "sAcceptDate", DbType.Date, AcceptDate.Date);
                db.AddInParameter(dbCommand, "sRECEIVERCODE2", DbType.String, sRECEIVERCODE2);
                db.AddInParameter(dbCommand, "sServiceType", DbType.String, ServiceType);
                //输出参数
                db.AddOutParameter(dbCommand, "sRetInfo", DbType.String, 500);
                //注意点,如果是oracle,可以不定义游标参数,但游标名称必须是cur_OUT
                string RetInfo = "";

                db.ExecuteNonQuery(dbCommand);
                //得到返回参数
                RetInfo = db.GetParameterValue(dbCommand, "sRetInfo").ToString();

                return RetInfo;
            }
            //插入验收记录2
            public static string PDA_Insert_PDA_DrugAcceptance2(string RecordNO, string BarCode, string ProductID, string DrugName, string DrugSpec, string DrugUnit, string Manufacturer, string DrugApprovalNumber, string SupplierID, string SupplierName, string ExpiryDate, string BatchNumber, int CodePages, decimal Amount, string Pack, string Verdict, string AcceptMan, DateTime AcceptDate, string ServiceType, string KWH, string PRDDATEDATE, string CHECKNO, string RECEIVERCODE2, string PUTWYERCODE1, string CHECKBILLNO, string SHIPVIA, string TRANSID, string SHIPDATE, string SHIPTEMPERATURE, string MEMO1, string MEMO2, string MEMO3, string GERMLOTNO, string CLEARDEGREE, string CERT, string ASSAY, string RECMARK, string LOCKTYPE,string deptID,string sChineseName,string sAGREE_CODE)
            {
                Database db = DatabaseFactory.CreateDatabase(SUNRFRC);

                string sqlCommand = "PDA_Insert_PDA_DrugAcceptance2";
                DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
                db.AddInParameter(dbCommand, "sRecordNO", DbType.String, RecordNO);
                db.AddInParameter(dbCommand, "sBarCode", DbType.String, BarCode);
                db.AddInParameter(dbCommand, "sProductID", DbType.String, ProductID);
                db.AddInParameter(dbCommand, "sDrugName", DbType.String, DrugName);
                db.AddInParameter(dbCommand, "sDrugSpec", DbType.String, DrugSpec);
                db.AddInParameter(dbCommand, "sDrugUnit", DbType.String, DrugUnit);
                db.AddInParameter(dbCommand, "sManufacturer", DbType.String, Manufacturer);
                db.AddInParameter(dbCommand, "sDrugApprovalNumber", DbType.String, DrugApprovalNumber);
                db.AddInParameter(dbCommand, "sSupplierID", DbType.String, SupplierID);
                db.AddInParameter(dbCommand, "sSupplierName", DbType.String, SupplierName);
                db.AddInParameter(dbCommand, "sExpiryDate", DbType.String, ExpiryDate);
                db.AddInParameter(dbCommand, "sBatchNumber", DbType.String, BatchNumber);
                db.AddInParameter(dbCommand, "sCodePages", DbType.Decimal, CodePages);
                db.AddInParameter(dbCommand, "sAmount", DbType.Decimal, Amount);
                db.AddInParameter(dbCommand, "sPack", DbType.String, Pack);
                db.AddInParameter(dbCommand, "sVerdict", DbType.String, Verdict);
                db.AddInParameter(dbCommand, "sAcceptMan", DbType.String, AcceptMan);
                db.AddInParameter(dbCommand, "sAcceptDate", DbType.Date, AcceptDate.Date);
                db.AddInParameter(dbCommand, "sServiceType", DbType.String, ServiceType);
                //新增字段
                 db.AddInParameter(dbCommand, "sKWH", DbType.String, KWH);
                 db.AddInParameter(dbCommand, "sPRDDATEDATE", DbType.String, PRDDATEDATE);
                 db.AddInParameter(dbCommand, "sCHECKNO", DbType.String, CHECKNO);
                 db.AddInParameter(dbCommand, "sRECEIVERCODE2", DbType.String, RECEIVERCODE2);
                 db.AddInParameter(dbCommand, "sPUTWYERCODE1", DbType.String, PUTWYERCODE1);
                 db.AddInParameter(dbCommand, "sCHECKBILLNO", DbType.String, CHECKBILLNO);
                 db.AddInParameter(dbCommand, "sSHIPVIA", DbType.String, SHIPVIA);
                 db.AddInParameter(dbCommand, "sTRANSID", DbType.String, TRANSID);
                 db.AddInParameter(dbCommand, "sSHIPDATE", DbType.String, SHIPDATE);
                 db.AddInParameter(dbCommand, "sSHIPTEMPERATURE", DbType.String, SHIPTEMPERATURE);
                 db.AddInParameter(dbCommand, "sMEMO1", DbType.String, MEMO1);
                 db.AddInParameter(dbCommand, "sMEMO2", DbType.String, MEMO2);
                 db.AddInParameter(dbCommand, "sMEMO3", DbType.String, MEMO3);
                 db.AddInParameter(dbCommand, "sGERMLOTNO", DbType.String, GERMLOTNO);
                 db.AddInParameter(dbCommand, "sCLEARDEGREE", DbType.String, CLEARDEGREE);
                 db.AddInParameter(dbCommand, "sCERT", DbType.String, CERT);
                 db.AddInParameter(dbCommand, "sASSAY", DbType.String, ASSAY);
                 db.AddInParameter(dbCommand, "sRECMARK", DbType.String, RECMARK);
                 db.AddInParameter(dbCommand, "sLOCKTYPE", DbType.String, LOCKTYPE);
                 db.AddInParameter(dbCommand, "sDepartmentID", DbType.String, deptID);
                 //sChineseName
                 db.AddInParameter(dbCommand, "sChineseName", DbType.String, sChineseName);
                 //sAGREE_CODE
                 db.AddInParameter(dbCommand, "sAGREE_CODE", DbType.String, sAGREE_CODE);
                //输出参数
                db.AddOutParameter(dbCommand, "sRetInfo", DbType.String, 500);
                //注意点,如果是oracle,可以不定义游标参数,但游标名称必须是cur_OUT
                string RetInfo = "";

                db.ExecuteNonQuery(dbCommand);
                //得到返回参数
                RetInfo = db.GetParameterValue(dbCommand, "sRetInfo").ToString();

                return RetInfo;
            }
            //将形如1001,品种 这种格式处理返回1001
            public static string SplitTypeGetCode(string AllType)
            {
                string[] TypeCode = AllType.Split(',');
                return TypeCode[0].ToString();
            }
            public static string SplitTypeGetCode(string AllType,int pos,char SplitChar)
            {
                string[] TypeCode = AllType.Split(SplitChar);
                return TypeCode[pos].ToString();
            }
            //根据预报单号得到当前单号所产生的所有验收单品种批号,PDA_GetAcceptanceByRecordNO,由预报单号,RecordNO varchar2,
            public static DataSet PDA_GetAccGoodsByRecordNO(string RecordNO)
            {

                Database db = DatabaseFactory.CreateDatabase(SUNRFRC);

                string sqlCommand = "PDA_GetAccGoodsByRecordNO";
                DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
                db.AddInParameter(dbCommand, "sRecordNO", DbType.String, RecordNO);
                //注意点,如果是oracle,可以不定义游标参数,但游标名称必须是cur_OUT
                DataSet ds = null;

                ds = db.ExecuteDataSet(dbCommand);
                return ds;
            }
            //PDA_GetExistAcceptance,得到存在的验收记录 IDNUM NUMBER,
            public static DataSet PDA_GetExistAcceptance(decimal IDNUM)
            {

                Database db = DatabaseFactory.CreateDatabase(SUNRFRC);

                string sqlCommand = "PDA_GetExistAcceptance";
                DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
                db.AddInParameter(dbCommand, "IDNUM", DbType.Decimal, IDNUM);
                //注意点,如果是oracle,可以不定义游标参数,但游标名称必须是cur_OUT
                DataSet ds = null;

                ds = db.ExecuteDataSet(dbCommand);
                return ds;
            }
            //药检单单号判断RF_GET_SYS_PARM_CUST(ln_compid, ln_ownerid, ln_deptid,'30003',ls_needchkbill, ai_rtd, as_rmsg);
            public static bool RF_GET_SYS_PARM_CUST(decimal deptid)//判断如果为新批号,是否输入药检单单号
            {
                //用这句来取select a.ownerid into ln_ownerid from pub_dept a where a.deptcode =  ls_deptcode;
                //用这句来取 select a.deptid into ln_deptid from pub_dept a where a.deptcode = ls_deptcode;

                Database db = DatabaseFactory.CreateDatabase(SUNRFRC);

                string sqlCommand = "RF_GET_SYS_PARM_CUST";
                DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
                db.AddInParameter(dbCommand, "an_compid", DbType.Decimal, 1);
                db.AddInParameter(dbCommand, "an_ownerid", DbType.Decimal, 1);
                db.AddInParameter(dbCommand, "an_bizdeptid", DbType.Decimal, deptid);


                db.AddInParameter(dbCommand, "as_parmid", DbType.String, "30003");

                db.AddOutParameter(dbCommand, "as_custvalue", DbType.String, 500);
                db.AddOutParameter(dbCommand, "ai_rtd", DbType.String, 500);
                db.AddOutParameter(dbCommand, "as_rmsg", DbType.String, 500);
                //注意点,如果是oracle,可以不定义游标参数,但游标名称必须是cur_OUT
                string RetInfo = "";

                db.ExecuteNonQuery(dbCommand);
                //得到返回参数
                RetInfo = db.GetParameterValue(dbCommand, "as_custvalue").ToString();

                if (RetInfo == "10")
                    return true;
                else
                    return false;

            }


            public static bool GetLocalMac(string Corp)
            {
                bool isReg=false;
                string IPAddress=System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName()).AddressList[0].ToString();
                    string mac =GetMACFromIP(IPAddress);
                    if (mac == "00-1A-64-26-D2-82" || mac == "00-1A-64-26-D2-80" || mac == "00-1D-72-98-EA-29")
                        isReg=true;
                return isReg;
            }
            public static string GetMACFromIP(string A_strIP)
            {
                string strRet = "Unknown";

                string strIPPattern = @"^\d+\.\d+\.\d+\.\d+$";

                Regex objRex = new Regex(strIPPattern);

                if (objRex.IsMatch(A_strIP) == true)
                {
                    Int32 intDest = inet_addr(A_strIP);
                    Int32[] arrMAC = new Int32[2];
                    Int32 intLen = 6;

                    int intResult = SendARP(intDest, 0, ref   arrMAC[0], ref   intLen);

                    if (intResult == 0)
                    {
                        Byte[] arrbyte = new Byte[8];
                        arrbyte[5] = (Byte)(arrMAC[1] >> 8);
                        arrbyte[4] = (Byte)arrMAC[1];
                        arrbyte[3] = (Byte)(arrMAC[0] >> 24);
                        arrbyte[2] = (Byte)(arrMAC[0] >> 16);
                        arrbyte[1] = (Byte)(arrMAC[0] >> 8);
                        arrbyte[0] = (Byte)arrMAC[0];

                        StringBuilder strbMAC = new StringBuilder();

                        for (int intIndex = 0; intIndex < 6; intIndex++)
                        {
                            if (intIndex > 0) strbMAC.Append("-");
                            strbMAC.Append(arrbyte[intIndex].ToString("X2"));
                        }
                        strRet = strbMAC.ToString();
                    }
                }

                return strRet;
            }


        }

    }
    ORACLE存储过程

    create or replace procedure cmsgstest.PDA_GetDrugAcceptance(
    RecordNO varchar2,
    BarCode varchar2,
    PH VARCHAR2,
    cur_OUT  out sys_refcursor)

    is

    li_count number;
    begin
       --由条码得到
        --select goodid into li_GoodsId from pub_waredict where goodbar=BarCode;--这里改成对应软件的药品库
     --得到当前单据当前品种的采购计划
    --b.GOODBAR

      select count(*) into li_count
      from inpt_wms_inbound_dtl a,pub_waredict b,pub_clients c, scm_lot_list_v d
      where a.goodid=b.goodid AND a.cstid = c.cstid(+) and a.status  in ('00','10')  and a.stopflag = '00'
      and a.billno=RecordNO  and d.lotno =PH;
      if li_count>0 then
          OPEN cur_OUT for select a.BILLNO as RecordNO ,b.goods as BarCode,b.GOODID as ProductID,
        b.name as DrugName, b.spec as DrugSpec, b.msunitno as DrugUnit, producer as Manufacturer, b.ratifier as DrugApprovalNumber, c.cstcode AS SupplierID,c.dname SupplierName,
        A.BILLQTY AS AMOUNT , d.prddate,d.enddate, d.ratifier,d.register_code,
        d.memo1, d.memo2, d.memo3, d.germlotno, d.checkno,
        d.chinesename, d.assay, d.agree_code, d.cert, d.cleardegree
        from inpt_wms_inbound_dtl a,pub_waredict b,pub_clients c, scm_lot_list_v d
        where
        a.goodid=b.goodid AND a.cstid = c.cstid(+)
        and a.compid = d.compid(+) and a.goodid = d.goodid(+)
        and a.status  in ('00','10') and a.stopflag = '00'
        and a.billno=RecordNO  and d.lotno =PH;
      else
        OPEN cur_OUT for select a.BILLNO as RecordNO ,b.goods as BarCode,b.GOODID as ProductID,
        b.name as DrugName, b.spec as DrugSpec, b.msunitno as DrugUnit, producer as Manufacturer, b.ratifier as DrugApprovalNumber, c.cstcode AS SupplierID,c.dname SupplierName,A.BILLQTY AS AMOUNT,
         '' as prddate,'' as enddate, '' as ratifier,'' as register_code,
        '' as memo1, '' as memo2, '' as memo3, '' as germlotno, '' as checkno,
        '' as chinesename, '' as assay, '' as agree_code, '' as cert, '' as cleardegree
        from inpt_wms_inbound_dtl a,pub_waredict b,pub_clients c
        where a.goodid=b.goodid AND a.cstid = c.cstid(+)
        and a.billno=RecordNO; 
      end if;

    end PDA_GetDrugAcceptance;

  • 相关阅读:
    说说内核与计算机硬件结构
    为什么51单片机的地址总线是16位的,但是它却是8位机?
    哈弗结构与冯诺依曼结构
    关于ARM的内核架构
    Bootloader之uBoot简介(转)
    mysql优化
    java上传并下载以及解压zip文件有时会报文件被损坏错误分析以及解决
    [Java]读取文件方法大全
    request相关研究
    session与cookie
  • 原文地址:https://www.cnblogs.com/hhq80/p/1491828.html
Copyright © 2020-2023  润新知