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 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);
    }
Beispiel #4
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);
                }
                Bubbleinfo bl         = new Bubbleinfo();
                DataTable  dt         = bl.findBubbleBybarcode(tisaneNum);
                int        result     = 0;
                string     machine    = "[]";
                string     tisaneunit = "[]";
                int        flag       = 0;
                if (dt.Rows.Count > 0)
                {
                    if ("1".Equals(dt.Rows[0]["bubblestatus"].ToString()))
                    {
                        result = 0;
                    }
                    else
                    {
                        DataTable table = bl.findMachineByStartAndFree();
                        if (table.Rows.Count > 0)
                        {
                            machine = DataTableToJson.ToJson(table);
                            result  = bl.updateBubble(Convert.ToInt32(dt.Rows[0]["id"].ToString()), 1, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), dt.Rows[0]["starttime"].ToString());
                        }
                        else
                        {
                            result = 0;
                            flag   = 1;
                        }

                        DataTable tisaneunits = bl.findTisaneunitByPid(Convert.ToInt32(tisaneNum));
                        if (tisaneunits.Rows.Count > 0)
                        {
                            tisaneunit = DataTableToJson.ToJson(tisaneunits);
                        }
                    }
                }
                else
                {
                    RecipeModel rem    = new RecipeModel();
                    DataTable   dtable = rem.findRecheckedFinish(Convert.ToInt32(tisaneNum));
                    if (dtable.Rows.Count > 0)
                    {
                        result = bl.addbubble(Convert.ToInt32(userNum), nowDate, barcode, "泡药", tisaneNum, imgname, waterYield, userName);
                    }
                    else
                    {
                        result = 0;
                    }
                }

                if (result > 0)
                {
                    Response.Write("{\"code\":\"0\",\"msg\":\"操作成功\",\"machine\":" + machine + ",\"tisaneunit\":" + tisaneunit + ",\"flag\":\"" + flag + "\"}");
                }
                else
                {
                    Response.Write("{\"code\":\"1\",\"msg\":\"操作失败\",\"flag\":\"" + flag + "\"}");
                }
            }
            catch (Exception e1)
            {
                Response.Write("{\"code\":\"1\",\"msg\":\"操作失败\"}");
            }
        }
        else if ("get".Equals(type))
        {
            String      id        = Request.QueryString["id"].ToString();
            string      date      = DateTime.Now.ToString("yyyy-MM-dd");
            Bubbleinfo  bi        = new Bubbleinfo();
            RecipeModel rm        = new RecipeModel();
            string      warningid = rm.getRetentionWarning(3);
            string      timeout   = bi.getTimeoutNumber(date);
            DataTable   dataTable = bi.getBubbleInfo(Convert.ToInt32(id), date);

            Response.Write("{\"code\":\"0\",\"msg\":\"操作成功\",\"data\":" + DataTableToJson.ToJson(dataTable) + ",\"warning\":\"" + warningid + "\",\"timeout\":\"" + timeout + "\"}");
        }
        else if ("updateMachine".Equals(type))
        {
            Bubbleinfo bi        = new Bubbleinfo();
            string     tid       = Request.Form["tid"];       //分配机组记录id
            string     machineid = Request.Form["machineid"]; //煎药机id
            bi.updateTisaneunitByMachineid(Convert.ToInt32(tid), Convert.ToInt32(machineid));
            Response.Write("{\"code\":\"0\",\"msg\":\"操作成功\"}");
        }
    }