コード例 #1
0
    protected void btnGridopt_Click(object sender, EventArgs e)//出库,调用接口,变更库存情况
    {
        Button btn    = (Button)sender;
        int    index  = ((GridViewRow)btn.NamingContainer).RowIndex;//获得行号
        string id     = GridView1.DataKeys[index].Values[0].ToString();
        string aprv   = ((Label)GridView1.Rows[index].FindControl("labAudit")).Text;
        string planno = GridView1.DataKeys[index].Values[1].ToString();

        if (aprv == "己通过")
        {
            List <string> commandlist = new List <string>();
            commandlist.Add("update HT_STRG_FLAVOR set ISSUE_STATUS = '1',ISSUER_ID ='" + ((MSYS.Data.SysUser)Session["User"]).id + "'  where ORDER_SN = '" + id + "'");
            commandlist.Add("update HT_PROD_MONTH_PLAN_DETAIL set  FLAVOR_STATUS = '2' where PLAN_NO = '" + planno + "' and FLAVOR_STATUS = '1'");
            MSYS.Web.StorageOpt st = new MSYS.Web.StorageOpt();
            ////调用接口,变更库存////
            string flag = st.XiangInOrOut(id, ((MSYS.Data.SysUser)Session["User"]).text, ((MSYS.Data.SysUser)Session["User"]).id);
            /////
            if (flag.Length > 9 && flag.Substring(0, 9) == "notenough")
            {
                ScriptManager.RegisterStartupScript(GridView1, this.GetType(), "scriptKey", "alert(‘物料不足" + flag.Substring(9) + "’)", true);
            }
            MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator();
            string log_message      = opt.TransactionCommand(commandlist) == "Success" ? "出入库成功" : "出入库失败";
            log_message += "--标识:" + id;
            InsertTlog(log_message);
            bindGrid1();
        }
        else
        {
            ScriptManager.RegisterStartupScript(UpdatePanel1, this.Page.GetType(), "", "alert('请通过审批后再出库');", true);
        }
    }
コード例 #2
0
    protected void bindGrid1()
    {
        MSYS.Web.StorageOpt strg = new MSYS.Web.StorageOpt();
        DataTable           data = strg.queryStorage(txtYear.Text, txtname.Text, txtcatgory.Text, txttype.Text, txtprovince.Text, txtwarehouse.Text);

        GridView1.DataSource = data;
        GridView1.DataBind();
    }