public dotNetFlexGrid.DataHandlerResult FlexGridRecipeDataHandler(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);//调用演示的数据生成函数产生模拟数据 string tisaneid = "0"; if (p.extParam.ContainsKey("tisaneid")) { tisaneid = p.extParam["tisaneid"]; } if (tisaneid == "") { tisaneid = "0"; } TeModel tm = new TeModel(); result.table = tm.getPreBytisaneid(Convert.ToInt32(tisaneid)); dotNetFlexGrid.FieldFormatorHandle proc = delegate(DataRow dr) { string a = ""; int tstatus = Convert.ToInt32(dr["tisanestatus"].ToString()); if (tstatus == 0) { a = "开始煎药"; } else if (tstatus == 1) { a = "煎药完成"; } /* else * { * a = "煎药"; * }*/ return(a); }; result.FieldFormator.Register("tisanestatus", proc); //如果传递的参数包含排序设置的话,通过DataView.Sort功能模拟进行当页排序 //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(); //} 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); }
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\":\"操作成功\"}"); } }