Ejemplo n.º 1
0
    public void refreAllOut()
    {
        DataSet ds = new DAL.OutoutDAO().getOutsWhereFailToOut();

        GridView1.DataSource = ds.Tables[0].DefaultView.ToTable();
        GridView1.DataBind();
        refreEmpty();
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 刷新函数,刷新收货商
    /// </summary>
    public void refre_receive()
    {
        if (outout == null)
        {
            List <Outout> dcs = new DAL.OutoutDAO().getAllOut();
            GridView2.DataSource = dcs;
        }
        else
        {
            GridView2.DataSource = inin;
        }
        GridView2.DataBind();

        refre_receive_Empty();
    }
Ejemplo n.º 3
0
 public void refreshAll()
 {
     if (dt == null)
     {
         List <Outout> dcs = new DAL.OutoutDAO().getAllOut();
         GridView1.DataSource = dcs;
         GridView1.DataBind();
         refreshEmpty();
     }
     else
     {
         DateTime      d   = DateTime.Parse(dt);
         List <Outout> dcs = new DAL.OutoutDAO().getOutsByDate(d.ToShortDateString());
         GridView1.DataSource = dcs;
         GridView1.DataBind();
         refreshEmpty();
     }
 }
Ejemplo n.º 4
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "editt")
        {
            int          xy   = Convert.ToInt32(e.CommandArgument);
            Model.Outout outs = new DAL.OutoutDAO().getOutsById(GridView1.Rows[xy].Cells[1].Text);
            addOut.Visible = true;
            Button      btn = sender as Button;
            GridViewRow row = GridView1.Rows[xy];

            Label13.Text       = "库位编号";
            outID              = row.Cells[1].Text;
            outBatch           = outs.BatchNum;
            TextBox7.Text      = outs.PositionNum;
            TextBox7.ReadOnly  = true;
            TextBox8.Text      = outs.GoodsNum;
            TextBox9.Text      = outs.OutAmount.ToString();
            TextBox10.Text     = new DAL.BatchDao().getBatchByNum(outs.BatchNum).ProorrecNum;
            TextBox10.ReadOnly = true;
            TextBox11.Text     = outs.Remark;
            TextBox12.Text     = outs.Date.ToShortDateString();
            Button6.Text       = "确认修改";
            Button7.Text       = "取消修改";
            GridView1.Visible  = false;
        }
        if (e.CommandName == "deletee")
        {
            new Warehouse.Tools.AddSysLog().addlog("1", "未完成出库", "删除");
            int    x    = Convert.ToInt32(e.CommandArgument);
            string inid = GridView1.Rows[x].Cells[2].Text;
            bool   yy   = new DAL.IninDAO().deleteInById(inid);
            if (yy)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('删除成功!');", true);
                refreAllOut();
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('删除失败!');", true);
            }
        }
    }
Ejemplo n.º 5
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (TextBox1.Text.Trim() == "")
     {
         refreshAll();
     }
     else
     {
         DateTime dt;
         try
         {
             dt = DateTime.Parse(TextBox1.Text.Trim());
             List <Outout> ins = new DAL.OutoutDAO().getOutsByDate(dt.ToShortDateString());
             GridView1.DataSource = ins;
             GridView1.DataBind();
             new Warehouse.Tools.AddSysLog().addlog("1", "出库日报", "查询");
             refreshEmpty();
         }
         catch
         {
             Response.Write("<script>alert('格式不正确,应输入例:2018-8-8!')</script>");
         }
     }
 }
Ejemplo n.º 6
0
    protected void Button6_Click(object sender, EventArgs e)            //添加出库按钮点击事件
    {
        cleaTitle();
        Button b = sender as Button;

        if (TextBox7.Text.Trim() == "" || TextBox8.Text.Trim() == "" || TextBox9.Text.Trim() == "" || TextBox10.Text.Trim() == "" || TextBox11.Text.Trim() == "" || TextBox12.Text.Trim() == "")
        {
            Response.Write("<script>alert('所有信息不能为空!')</script>");
        }
        else
        {
            bool condition = true;       //记录输入的东西是否符合条件,全都正确为true
            Inin i         = new DAL.IninDAO().getInsById(TextBox7.Text.Trim());
            if (i == null)
            {
                condition    = false;
                Label14.Text = "没有查询到此入库";
            }

            Goods  g  = new DAL.GoodsDAO().getGoodsByNum(TextBox8.Text.Trim());
            Amount am = null;
            if (g == null)
            {
                condition    = false;
                Label16.Text = "没有查询到此物品";
            }
            else
            {
                List <string> sql = new List <string>();
                sql.Add(" and positionNum ='" + i.PositionNum + "'");
                sql.Add(" and GoodsNum='" + g.GoodsNum + "'");
                am = new DAL.AmountDAO().getAmountsByWherePoAndGo(sql);
                if (am == null)
                {
                    condition    = false;
                    Label16.Text = "此物品在此库位无存货";
                }
                else if (am.Amounts <= 0)
                {
                    condition    = false;
                    Label16.Text = "此物品在此库位无存货";
                }
            }

            int outamount;
            try
            {
                outamount = int.Parse(TextBox9.Text.Trim());
                if (outamount <= 0)
                {
                    condition    = false;
                    outamount    = 0;
                    Label18.Text = "输入格式错误,请输入大于0的整数";
                }
                else if (am != null)
                {
                    if (am.Amounts < outamount)
                    {
                        condition    = false;
                        outamount    = 0;
                        Label18.Text = "库存数量小于出货数量";
                    }
                }
            }
            catch
            {
                condition    = false;
                outamount    = 0;
                Label18.Text = "输入格式错误,请输入整数";
            }

            Receiver re = new DAL.ReceiverDAO().getReceiverByNum(TextBox10.Text.Trim());
            if (re == null)
            {
                condition    = false;
                Label20.Text = "没有查询到此收货商";
            }

            if (TextBox11.Text.Length >= 100)
            {
                condition    = false;
                Label22.Text = "输入长度必须小于100";
            }

            DateTime dt;
            try
            {
                dt = DateTime.Parse(TextBox12.Text.Trim());
                if (b.Text != "确认修改")
                {
                    if (dt < DateTime.Now)
                    {
                        condition    = false;
                        Label24.Text = "输入日期必须大于等于今天的日期";
                    }
                }
            }
            catch
            {
                condition    = false;
                dt           = DateTime.Parse("2018-8-8");
                Label24.Text = "输入日期的格式不正确";
            }

            if (condition)
            {
                if (b.Text != "确认修改")
                {
                    Batch bt = new Batch();
                    bt.BatchNum    = new Warehouse.Tools.batchNum().protect_batchNumByWPB("收货");
                    bt.ProorrecNum = TextBox10.Text.Trim();
                    bt.Condition   = "准备";
                    bt.OutorinType = "出库";
                    bool batchsucc = new DAL.BatchDao().addBatch(bt);
                    new Warehouse.Tools.AddSysLog().addlog("1", "批次", "添加");
                    Outout oo = new Outout();
                    oo.PositionNum = i.PositionNum;
                    oo.GoodsNum    = TextBox8.Text.Trim();
                    oo.OutAmount   = outamount;
                    oo.Remark      = TextBox11.Text.Trim();
                    oo.Date        = dt;
                    bool outoutsucc = new DAL.OutoutDAO().addOut(oo);
                    if (batchsucc && outoutsucc)
                    {
                        new Warehouse.Tools.AddSysLog().addlog("1", "未完成出库", "添加");
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加成功!');", true);
                        addOut.Visible = true;
                        refreAllOut();
                        clea();
                    }
                    else
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('添加失败!');", true);
                    }
                }
                else
                {
                    Outout oo = new Outout();
                    oo.PositionNum = TextBox1.Text.Trim();
                    oo.GoodsNum    = TextBox2.Text.Trim();
                    oo.OutAmount   = outamount;
                    oo.Remark      = TextBox5.Text.Trim();
                    oo.Date        = dt;
                    oo.OuID        = outID;
                    oo.BatchNum    = outBatch;
                    oo.UserId      = "1";
                    bool ininsucc = new DAL.OutoutDAO().updateOut(oo);
                    if (ininsucc)
                    {
                        new Warehouse.Tools.AddSysLog().addlog("1", "未完成出库", "修改");
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('修改成功!');", true);

                        addIn.Visible     = false;
                        GridView2.Visible = true;
                        refreAllIn();
                        outID    = null;
                        outBatch = null;
                        clea();
                    }
                    else
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "alert('修改失败!');", true);
                    }
                }
            }
            else
            {
            }
        }
    }
Ejemplo n.º 7
0
    protected void Button3_Click(object sender, EventArgs e)
    {
        if (in_out)
        {
            List <Inin>   ins      = null;
            List <string> sqlwhere = new List <string>();
            if (TextBox1.Text.Trim() != "" && TextBox2.Text.Trim() != "")          //判断时间是否填写
            {
                DateTime dt1;
                DateTime dt2;
                try
                {
                    dt1 = DateTime.Parse(TextBox1.Text.Trim());
                    dt2 = DateTime.Parse(TextBox2.Text.Trim());

                    if (dt1 > dt2)
                    {
                        Response.Write("<script>alert('日期区间错误应从小到大!')</script>");
                        return;
                    }
                    else
                    {
                        sqlwhere.Add(" and date between '" + dt1.ToShortDateString().ToString() + " 00:00:00' and '" + dt2.ToShortDateString().ToString() + " 00:00:00' ");
                    }
                }
                catch
                {
                    Response.Write("<script>alert('日期格式不正确,应输入例:2018-8-8!')</script>");
                    return;
                }
            }

            if (ListBox1.Text != "")            //判断物品类别是否选择
            {
                if (ListBox2.Text != "")
                {
                    if (ListBox3.Text != "")
                    {
                        sqlwhere.Add(" and goods.goodsTypeNum='" + ListBox3.SelectedValue.ToString() + "'");
                    }
                    else
                    {
                        sqlwhere.Add(" and goods.goodsTypeNum='" + ListBox2.SelectedValue.ToString() + "'");
                    }
                }
                else
                {
                    sqlwhere.Add(" and goods.goodsTypeNum='" + ListBox1.SelectedValue.ToString() + "'");
                }
            }
            if (ListBox4.Text != "")         //判断库柜是否选择
            {
                sqlwhere.Add(" and chest.chestNum='" + ListBox4.SelectedValue.ToString() + "'");
            }

            if (ListBox5.Text != "")         //判断经办人是否选择
            {
                sqlwhere.Add(" and sysuser.staffNum='" + ListBox5.SelectedValue.ToString() + "'");
            }

            if (ListBox6.Text != "")         //判断供应商是否选择
            {
                sqlwhere.Add(" and provider.providerNum='" + ListBox6.SelectedValue.ToString() + "'");
            }
            ins = new DAL.IninDAO().getInsByWhere(sqlwhere);

            inin = ins;
            GridView1.DataSource = ins;
            GridView1.DataBind();
            new Warehouse.Tools.AddSysLog().addlog("1", "出入库汇总", "查询");
            refre_provide_Empty();
        }
        else
        {
            List <Outout> outs     = null;
            List <string> sqlwhere = new List <string>();
            if (TextBox3.Text.Trim() != "" && TextBox4.Text.Trim() != "")          //判断时间是否填写
            {
                DateTime dt1;
                DateTime dt2;
                try
                {
                    dt1 = DateTime.Parse(TextBox3.Text.Trim());
                    dt2 = DateTime.Parse(TextBox4.Text.Trim());

                    if (dt1 > dt2)
                    {
                        Response.Write("<script>alert('日期区间错误应从小到大!')</script>");
                        return;
                    }
                    else
                    {
                        sqlwhere.Add(" and date between '" + dt1.ToShortDateString().ToString() + " 00:00:00' and '" + dt2.ToShortDateString().ToString() + " 00:00:00' ");
                    }
                }
                catch
                {
                    Response.Write("<script>alert('日期格式不正确,应输入例:2018-8-8!')</script>");
                    return;
                }
            }

            if (ListBox1.Text != "")            //判断物品类别是否选择
            {
                if (ListBox2.Text != "")
                {
                    if (ListBox3.Text != "")
                    {
                        sqlwhere.Add(" and goods.goodsTypeNum='" + ListBox3.SelectedValue.ToString() + "'");
                    }
                    else
                    {
                        sqlwhere.Add(" and goods.goodsTypeNum='" + ListBox2.SelectedValue.ToString() + "'");
                    }
                }
                else
                {
                    sqlwhere.Add(" and goods.goodsTypeNum='" + ListBox1.SelectedValue.ToString() + "'");
                }
            }

            if (ListBox4.Text != "")         //判断库柜是否选择
            {
                sqlwhere.Add(" and chest.chestNum='" + ListBox4.SelectedValue.ToString() + "'");
            }

            if (ListBox5.Text != "")         //判断经办人是否选择
            {
                sqlwhere.Add(" and sysuser.staffNum='" + ListBox5.SelectedValue.ToString() + "'");
            }

            if (ListBox6.Text != "")         //判断供应商是否选择
            {
                sqlwhere.Add(" and receiver.receiverNum='" + ListBox6.SelectedValue.ToString() + "'");
            }

            outs   = new DAL.OutoutDAO().getOutsByWhere(sqlwhere);
            outout = outs;
            GridView2.DataSource = outs;
            GridView2.DataBind();
            new Warehouse.Tools.AddSysLog().addlog("1", "出入库汇总", "查询");
            refre_receive_Empty();
        }
    }