protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            HospitalModel hm  = new HospitalModel();
            SqlDataReader sdr = hm.findHospitalAll();

            if (sdr != null)
            {
                while (sdr.Read())
                {
                    //  this.hospitalSelect.Items.Add(new ListItem(sdr["Hname"].ToString(), sdr["ID"].ToString()));
                }
            }
        }


        if (Request.QueryString["id"] != null)
        {
            int id = Convert.ToInt16(Request.QueryString["id"]);
            idnum.Value = Request.QueryString["id"].ToString();
            Bubbleinfo bl = new Bubbleinfo();
            DataTable  dt = bl.getBubbleInfo(id);

            bubbleperson.Value = dt.Rows[0]["bp"].ToString();

            // hospitalname.Value = dt.Rows[0][""].ToString();

            // bubbleman.Value = dt.Rows[0]["bp"].ToString();
        }
    }
    public static string getWarning()
    {
        //报警
        Bubbleinfo bi        = new Bubbleinfo();
        string     warningid = bi.bubblewarning();

        return(warningid);
    }
    public static int addbubbleinfo(string tisanebarcode, string bubbleperson, string mark, string wateryield)
    {
        Bubbleinfo bi  = new Bubbleinfo();
        int        sdr = bi.addbubble(tisanebarcode, bubbleperson, mark, wateryield);


        return(sdr);
    }
    public static bool checkisdone(string id)
    {
        Bubbleinfo bi = new Bubbleinfo();


        bool result = bi.checkisdone(id);

        return(result);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        TeModel       tm  = new TeModel();
        SqlDataReader sdr = tm.findTisaneAll();



        if (sdr != null)
        {
            while (sdr.Read())
            {
                this.tisanenum.Items.Add(new ListItem(sdr["machinename"].ToString(), sdr["id"].ToString()));
            }
        }



        //teid.Text = "nihao";
        // testatus1.Text = "空闲";
        // teroomid.Text = "1号机房";
        // testatus2.Text ="良好";
        int a = Convert.ToInt32(tisanenum.Value);

        SqlDataReader sdr1 = tm.findTisaneAllbyId(a);

        if (sdr1.Read())
        {
            // teid.Text = sdr1["tisaneunitid"].ToString();
        }
        else
        {
            tehealthstatus.Text = "无";
            teroomid.Text       = "无";
            texiaodustatus.Text = "无";
            status.Text         = "无";
            usingstatus.Text    = "无";
        }



        if (Request.QueryString["id"] != null)
        {
            int id = Convert.ToInt16(Request.QueryString["id"]);
            idnum.Value = Request.QueryString["id"].ToString();
        }


        Bubbleinfo    bi        = new Bubbleinfo();
        string        machineid = bi.distributionmachine();
        SqlDataReader sdr2      = tm.findmachinenamebyid(Convert.ToInt32(machineid));

        if (sdr2.Read())
        {
            recommend.Text = sdr2["machinename"].ToString();
        }
    }
    public static string updateGlobalInfo(int id, string bubbleperson)
    {
        Bubbleinfo bi     = new Bubbleinfo();
        int        result = bi.updateBubbleInfo(id, bubbleperson);

        string str = null;

        if (result == 0)
        {
            str = "0";
        }
        else
        {
            str = "1";
        }

        return(str);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["id"] != null)
        {
            int id = Convert.ToInt16(Request.QueryString["id"]);
            idnum.Value = Request.QueryString["id"].ToString();
        }

        if (!IsPostBack)
        {
            Bubbleinfo    bi  = new Bubbleinfo();
            SqlDataReader sdr = bi.findNameAll();


            if (sdr != null)
            {
                while (sdr.Read())
                {
                    this.bubbleperson.Items.Add(new ListItem(sdr["EmNumAName"].ToString()));
                    // this.SwapPer.Items.Add(new ListItem(sdr["JobNum"].ToString()));
                }
            }
            DataBaseLayer db = new DataBaseLayer();
            if (Session["userNamebar"] != null)
            {
                string name = Session["userNamebar"].ToString();

                string        sq1 = "select EmNumAName from Employee where jobnum ='" + name + "' ";
                SqlDataReader sr  = db.get_Reader(sq1);
                if (sr.Read())
                {
                    bubbleperson.Value = sr["EmNumAName"].ToString();
                }
            }
            else
            {
                Response.Write("<script>alert('用户名已失效');window.parent.loginview();</script>");
            }
        }
    }
    //导出数据
    protected void Button1_Click(object sender, EventArgs e)
    {
        string bubblestatus1 = bubblestatus.Value;

        string bubbleman1 = bubbleman.Value;

        if (bubbleman1 == "")
        {
            bubbleman1 = "0";
        }
        Bubbleinfo bi = new Bubbleinfo();

        // DataBaseLayer db = new DataBaseLayer();
        //    string str = "select * from lossiInfor where type ='" + type + "'";
        DataTable dt = bi.getBubbleInfoDao(bubbleman1, Convert.ToInt32(bubblestatus1));

        System.DateTime currentTime = new System.DateTime();
        currentTime = System.DateTime.Now;
        string now = currentTime.ToString("yyyyMMdd");

        CreateExcel(dt, "application/ms-excel", "泡药信息" + now);
    }
    public static bool distributionById(string strRowIds)
    {
        int  a = 0;
        bool result;

        string[] strRowsId = strRowIds.Split(',');
        for (int i = 0; i < strRowsId.Length; i++)
        {
            //RecipeModel rm = new RecipeModel();
            Bubbleinfo bi = new Bubbleinfo();
            //bi.deleteRecipeInfo(Convert.ToInt16(strRowsId[i]));
            a = bi.deleteBubbleInfo(Convert.ToInt32(strRowsId[i]));
        }
        if (a == 0)
        {
            result = false;
        }
        else
        {
            result = true;
        }

        return(result);
    }
Beispiel #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        String type = Request.QueryString["type"].ToString();

        if ("save".Equals(type))
        {
            try
            {
                string imgbase64  = Request.Form["imgbase64"];  //图片
                string tisaneNum  = Request.Form["tisaneNum"];  //煎药单号
                string userNum    = Request.Form["userNum"];    //员工号
                string barcode    = Request.Form["barcode"];    //条形码
                string waterYield = Request.Form["waterYield"]; //水量
                string userName   = Request.Form["userName"];   //员工姓名
                string imgname    = null;
                string nowDate    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                if (imgbase64 != null && imgbase64.Trim().Length > 0)
                {
                    imgbase64 = imgbase64.Replace(' ', '+');
                    Byte[] bimg = Convert.FromBase64String(imgbase64);
                    //D:\\项目\\煎药厂\\src\\web\\upload\\

                    String path = System.AppDomain.CurrentDomain.BaseDirectory.ToString() + "upload\\";
                    imgname = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".png";
                    FileBinaryConvertHelper.Bytes2File(bimg, path + imgname);
                }
                TeModel    tm         = new TeModel();
                Bubbleinfo bl         = new Bubbleinfo();
                DataTable  dt         = tm.findTisaneinfoBybarcode(tisaneNum);
                int        result     = 0;
                string     machine    = "[]";
                string     tisaneunit = "[]";
                string     flag       = "0";
                if (dt.Rows.Count > 0)
                {
                    if ("1".Equals(dt.Rows[0]["tisanestatus"].ToString()))
                    {
                        result = 0;
                    }
                    else
                    {
                        flag   = "1";
                        result = tm.updateTisaneinfo(Convert.ToInt32(dt.Rows[0]["id"].ToString()), 1, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), tisaneNum, dt.Rows[0]["starttime"].ToString());
                    }
                }
                else
                {
                    RecipeModel rem    = new RecipeModel();
                    DataTable   dtable = rem.findBubbleFinish(Convert.ToInt32(tisaneNum));
                    if (dtable.Rows.Count > 0)
                    {
                        DataTable table = bl.findMachineByStartAndFree();
                        if (table.Rows.Count > 0)
                        {
                            machine = DataTableToJson.ToJson(table);
                        }

                        DataTable tisaneunits = bl.findTisaneunitByPid(Convert.ToInt32(tisaneNum));
                        if (tisaneunits.Rows.Count > 0)
                        {
                            tisaneunit = DataTableToJson.ToJson(tisaneunits);
                        }
                        result = 1;
                    }
                    else
                    {
                        result = 0;
                    }
                }
                if (result > 0)
                {
                    Response.Write("{\"code\":\"0\",\"msg\":\"操作成功\",\"machine\":" + machine + ",\"tisaneunit\":" + tisaneunit + ",\"flag\":" + flag + "}");
                }
                else
                {
                    Response.Write("{\"code\":\"1\",\"msg\":\"操作失败\"}");
                }
            }
            catch (Exception e1)
            {
                Response.Write("{\"code\":\"1\",\"msg\":\"操作失败\"}");
            }
        }
        else if ("get".Equals(type))
        {
            String id = Request.QueryString["id"].ToString();

            TeModel tm = new TeModel();

            RecipeModel rm        = new RecipeModel();
            string      warningid = rm.getRetentionWarning(4);

            DataTable dataTable = tm.getPreBytisaneid(Convert.ToInt32(id), DateTime.Now.ToString("yyyy-MM-dd"));
            Response.Write("{\"code\":\"0\",\"msg\":\"操作成功\",\"data\":" + DataTableToJson.ToJson(dataTable) + ",\"warning\":\"" + warningid + "\"}");
        }
        else if ("updateMachine".Equals(type))
        {
            string imgbase64  = Request.Form["imgbase64"];  //图片
            string tisaneNum  = Request.Form["tisaneNum"];  //煎药单号
            string userNum    = Request.Form["userNum"];    //员工号
            string barcode    = Request.Form["barcode"];    //条形码
            string waterYield = Request.Form["waterYield"]; //水量
            string userName   = Request.Form["userName"];   //员工姓名
            string imgname    = null;
            string nowDate    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            if (imgbase64 != null && imgbase64.Trim().Length > 0)
            {
                imgbase64 = imgbase64.Replace(' ', '+');
                Byte[] bimg = Convert.FromBase64String(imgbase64);
                //D:\\项目\\煎药厂\\src\\web\\upload\\

                String path = System.AppDomain.CurrentDomain.BaseDirectory.ToString() + "upload\\";
                imgname = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".png";
                FileBinaryConvertHelper.Bytes2File(bimg, path + imgname);
            }

            Bubbleinfo bi        = new Bubbleinfo();
            string     tid       = Request.Form["tid"];       //分配机组记录id
            string     machineid = Request.Form["machineid"]; //煎药机id
            bi.updateTisaneunitByMachineid(Convert.ToInt32(tid), Convert.ToInt32(machineid));
            TeModel tm = new TeModel();
            tm.addTisaneinfo(Convert.ToInt32(userNum), nowDate, barcode, "煎药", tisaneNum, imgname, waterYield, userName);
            Response.Write("{\"code\":\"0\",\"msg\":\"操作成功\"}");
        }
    }
    public dotNetFlexGrid.DataHandlerResult DotNetFlexGrid2DataHandler(dotNetFlexGrid.DataHandlerParams p)
    {
        dotNetFlexGrid.DataHandlerResult result = new dotNetFlexGrid.DataHandlerResult();
        result.page  = p.page; //设定当前返回的页号
        result.total = 100;    //总计的数据条数,此处用100进行模拟,查询和筛选时需要根据实际
        // result.table = dotNetFlexGrid.DemoMemoryTable(p.page * 100, p.rp);//调用演示的数据生成函数产生模拟数据
        //如果传递的参数包含排序设置的话,通过DataView.Sort功能模拟进行当页排序


        string bubbleman = "0";

        if (p.extParam.ContainsKey("bubbleman"))
        {
            bubbleman = p.extParam["bubbleman"];
        }
        string bubblestatus = "0";

        if (p.extParam.ContainsKey("bubblestatus"))
        {
            bubblestatus = p.extParam["bubblestatus"];
        }


        // EmployeeHandler eh = new EmployeeHandler();
        //  result.table = eh.getBubbleInfo( Convert.ToInt32("1"));

        Bubbleinfo bi = new Bubbleinfo();

        result.table = bi.getBubbleInfo(bubbleman, Convert.ToInt32(bubblestatus));
        // result.table = rm.findRecipeInfo(1, "1", 0);
        //if (p.sortname.Length > 0 && p.sortorder.Length > 0)
        //{
        //    System.Data.DataView dv = result.table.DefaultView;
        //    dv.Sort = (p.sortname + " " + p.sortorder);
        //    result.table = dv.ToTable();
        //}
        ////处理默认查询,即Button1_Click中指定的DefaultSearch查询参数
        //if (p.defaultSearch.ContainsKey("String1"))
        //{
        //    System.Data.DataView dv = result.table.DefaultView;
        //    dv.RowFilter = "String1 Like '%" + p.defaultSearch["String1"] + "%'";
        //    result.table = dv.ToTable();
        //}

        ////如果传递的参数包含附加参数的话,再来模拟查询,原谅我真的很懒。
        //if (p.extParam.ContainsKey("String1"))
        //{
        //    System.Data.DataView dv = result.table.DefaultView;
        //    dv.RowFilter = "String1 Like '%" + p.extParam["String1"] + "%'";
        //    result.table = dv.ToTable();
        //}
        ////如果传递的参数包含快速查询参数,则进行快速查询
        //if (p.qop != dotNetFlexGrid.SerchParamConfigOperater.None && p.qtype.Length > 0 && p.query.Length > 0)
        //{
        //    System.Data.DataView dv = result.table.DefaultView;
        //    if (p.qop == dotNetFlexGrid.SerchParamConfigOperater.Like)
        //        dv.RowFilter = p.qtype + " Like '%" + p.query + "%'";
        //    else
        //        dv.RowFilter = p.qtype + " = '" + p.query + "'";
        //    result.table = dv.ToTable();
        //}

        return(result);
    }
    public dotNetFlexGrid.DataHandlerResult DotNetFlexGrid1DataHandler(dotNetFlexGrid.DataHandlerParams p)
    {
        dotNetFlexGrid.DataHandlerResult result = new dotNetFlexGrid.DataHandlerResult();
        result.page  = p.page; //设定当前返回的页号
        result.total = 100;    //总计的数据条数,此处用100进行模拟,查询和筛选时需要根据实际
        // result.table = dotNetFlexGrid.DemoMemoryTable(p.page * 100, p.rp);//调用演示的数据生成函数产生模拟数据
        //如果传递的参数包含排序设置的话,通过DataView.Sort功能模拟进行当页排序


        string bubbleman = "0";

        if (p.extParam.ContainsKey("bubbleman"))
        {
            bubbleman = p.extParam["bubbleman"];
        }
        string bubblestatus = "0";

        if (p.extParam.ContainsKey("bubblestatus"))
        {
            bubblestatus = p.extParam["bubblestatus"];
        }

        if (bubbleman == "")
        {
            bubbleman = "0";
        }


        Bubbleinfo bi = new Bubbleinfo();

        result.table = bi.getBubbleInfo(bubbleman, Convert.ToInt32(bubblestatus));


        dotNetFlexGrid.FieldFormatorHandle proc1 = delegate(DataRow dr)
        {
            int bstatus = Convert.ToInt32(dr["bubblestatus"].ToString());
            if (bstatus == 1)
            {
                return("泡药完成");
            }
            else
            {
                return("开始泡药");
            }
        };
        dotNetFlexGrid.FieldFormatorHandle proc1a = delegate(DataRow dr)
        {
            string z       = "";
            int    bstatus = Convert.ToInt32(dr["bubblestatus"].ToString());
            string start   = dr["starttime"].ToString();


            int soaktime = Convert.ToInt32(dr["soaktime"].ToString());
            if (bstatus == 0)
            {
                System.DateTime currentTime = new System.DateTime();
                currentTime = System.DateTime.Now;
                string   strtime = currentTime.ToString("yyyy-MM-dd HH:mm:ss");                                                                              //
                DateTime d1      = Convert.ToDateTime(strtime);                                                                                              //当前时间

                DateTime d2 = Convert.ToDateTime(start);                                                                                                     //开始时间

                TimeSpan d3 = d1.Subtract(d2);                                                                                                               //泡药时间

                int dT = Convert.ToInt32(d3.Days.ToString()) * 24 * 60 + Convert.ToInt32(d3.Hours.ToString()) * 60 + Convert.ToInt32(d3.Minutes.ToString()); //转化为分钟数

                string dt = dT.ToString();
                if (dT > soaktime)
                {
                    z = "<span style='color:red'>" + dt + "</span>";
                }
                else
                {
                    z = "<span style='color:black'>" + dt + "</span>";
                }
            }
            else
            {
                int d = Convert.ToInt32(dr["doingtime"].ToString());
                if (d > soaktime)
                {
                    z = "<span style='color:red'>" + dr["doingtime"].ToString() + "</span>";
                }
                else
                {
                    z = "<span style='color:black'>" + dr["doingtime"].ToString() + "</span>";
                }
            }

            return(z);
        };

        /*  dotNetFlexGrid.FieldFormatorHandle proc = delegate(DataRow dr)
         * {
         *    string a = "";
         *   int doingtime = Convert.ToInt32(dr["doingtime"].ToString());
         *   int soaktime =  Convert.ToInt32(dr["soaktime"].ToString());
         *
         *   if (doingtime > soaktime)
         *   {
         *       a = "<span style='color:red'>" + dr["doingtime"].ToString() + "</span>";
         *
         *   }
         *   else {
         *
         *       a = "<span style='color:black'>" + dr["doingtime"].ToString() + "</span>";
         *   }
         *
         *
         *    return a;
         *
         * };
         */
        result.FieldFormator.Register("bubblestatus", proc1);
        result.FieldFormator.Register("doingtime", proc1a);
        // result.FieldFormator.Register("doingtime", proc);

        //  result.FieldFormator.Register("warningstatus", proc1);

        dotNetFlexGrid.FieldFormatorHandle proc2 = delegate(DataRow dr)
        {
            int a = Convert.ToInt32(dr["sex"].ToString());
            if (a == 1)
            {
                return("男");
            }
            else
            {
                return("女");
            }
        };
        result.FieldFormator.Register("sex", proc2);
        dotNetFlexGrid.FieldFormatorHandle proc3 = delegate(DataRow dr)
        {
            int b = Convert.ToInt32(dr["decscheme"].ToString());
            if (b == 1)
            {
                return("微压(密闭)解表(15min)");
            }
            else if (b == 2)
            {
                return("微压(密闭)汤药(15min)");
            }
            else if (b == 3)
            {
                return("微压(密闭)补药(15min)");
            }
            else if (b == 4)
            {
                return("常压解表(10min,10min)");
            }
            else if (b == 5)
            {
                return("常压汤药(20min,15min)");
            }
            else if (b == 6)
            {
                return("常压补药(25min,20min)");
            }
            else if (b == 20)
            {
                return("先煎解表(10min,10min,10min)");
            }
            else if (b == 21)
            {
                return("先煎汤药(10min,20min,15min)");
            }
            else if (b == 22)
            {
                return("先煎补药(10min,25min,20min)");
            }
            else if (b == 36)
            {
                return("后下解表(10min(3:7),10min)");
            }
            else if (b == 37)
            {
                return("后下汤药(20min(13:7),15min)");
            }
            else if (b == 38)
            {
                return("后下补药(25min(18:7),20min)");
            }
            else if (b == 81)
            {
                return("微压自定义");
            }
            else if (b == 82)
            {
                return("常压自定义");
            }
            else if (b == 83)
            {
                return("先煎自定义");
            }
            else
            {
                return("后下自定义");
            }
        };
        result.FieldFormator.Register("decscheme", proc3);

        dotNetFlexGrid.FieldFormatorHandle proc4 = delegate(DataRow dr)
        {
            int a = Convert.ToInt32(dr["decmothed"].ToString());
            if (a == 1)
            {
                return("先煎");
            }
            else if (a == 2)
            {
                return("后下");
            }
            else
            {
                return("加糖加蜜");
            }
        };
        result.FieldFormator.Register("decmothed", proc4);
        dotNetFlexGrid.FieldFormatorHandle proc6 = delegate(DataRow dr)
        {
            int a = Convert.ToInt32(dr["takeway"].ToString());
            if (a == 1)
            {
                return("水煎餐后");
            }
            else
            {
                return("");
            }
        };
        result.FieldFormator.Register("takeway", proc6);
        dotNetFlexGrid.FieldFormatorHandle proc5 = delegate(DataRow dr)
        {
            int a = Convert.ToInt32(dr["dtbtype"].ToString());
            if (a == 1)
            {
                return("顺丰");
            }
            else if (a == 2)
            {
                return("圆通");
            }
            else
            {
                return("中通");
            }
        };
        result.FieldFormator.Register("dtbtype", proc5);
        return(result);
    }