public dotNetFlexGrid.DataHandlerResult DotNetFlexGrid1DataHandler(dotNetFlexGrid.DataHandlerParams p)
    {
        dotNetFlexGrid.DataHandlerResult result = new dotNetFlexGrid.DataHandlerResult();
        result.page  = p.page; //设定当前返回的页号
        result.total = 100;    //总计的数据条数,此处用100进行模拟,查询和筛选时需要根据实际

        PackingModel rm       = new PackingModel();
        string       Fpactate = "0";

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

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

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


        string StartTime = "0";

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


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

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


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


        dotNetFlexGrid.FieldFormatorHandle proc1 = delegate(DataRow dr)
        {
            if (dr["warningstatus"].ToString() == "1")
            {
                return("<span style='color:red'>黄色预警</span>");
            }
            else
            {
                return("<span style='color:black'>暂无预警</span>");
            }
        };



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


        result.table = rm.findPackingInfo(Fpactate, Pacpersonnel, PacTime, StartTime);
        dotNetFlexGrid.FieldFormatorHandle proc2 = delegate(DataRow dr)
        {
            int bstatus = Convert.ToInt32(dr["Fpactate"].ToString());
            if (bstatus == 1)
            {
                return("包装完成");
            }
            else
            {
                return("开始包装");
            }
        };
        result.FieldFormator.Register("Fpactate", proc2);

        return(result);
    }
Esempio n. 2
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 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);
                }
                PackingModel rm     = new PackingModel();
                DataTable    dt     = rm.findPackingBybarcode(tisaneNum);
                int          result = 0;
                if (dt.Rows.Count > 0)
                {
                    if ("1".Equals(dt.Rows[0]["Fpactate"].ToString()))
                    {
                        result = 0;
                    }
                    else
                    {
                        result = rm.updatePackinginfo(Convert.ToInt32(dt.Rows[0]["id"].ToString()), 1, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), tisaneNum);
                    }
                }
                else
                {
                    RecipeModel rem    = new RecipeModel();
                    DataTable   dtable = rem.findTisaneFinish(Convert.ToInt32(tisaneNum));

                    if (dtable.Rows.Count > 0)
                    {
                        result = rm.addPacking(Convert.ToInt32(userNum), nowDate, barcode, tisaneNum, imgname, userName);
                    }
                }

                if (result > 0)
                {
                    Response.Write("{\"code\":\"0\",\"msg\":\"操作成功\"}");
                }
                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();

            RecipeModel rm2       = new RecipeModel();
            string      warningid = rm2.getRetentionWarning(5);

            PackingModel rm        = new PackingModel();
            DataTable    dataTable = rm.findPackingInfo(Convert.ToInt32(id), DateTime.Now.ToString("yyyy-MM-dd"));
            Response.Write("{\"code\":\"0\",\"msg\":\"操作成功\",\"data\":" + DataTableToJson.ToJson(dataTable) + ",\"warning\":\"" + warningid + "\"}");
        }
    }