Example #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            DataSet ds = new BLL.StockPile().CheckStock(Convert.ToInt32(DropDownList1.SelectedValue));

            this.GridView1.DataSource = ds;
            this.GridView1.DataBind();
        }
Example #2
0
        protected void EnterAgain()//重新入库
        {
            //Model.Sale ml_sale = bll_sale.GetModel(Convert.ToInt32(Request.Params["Sale_ID"]));
            Model.EnterStock ml_es = bl_es.GetModel(EnterStock_ID);
            ml_es.StoreHouse_ID = Convert.ToInt32(DropDownList1.SelectedValue);
            bl_es.Update(ml_es);
            //ml_sale.GatheringWay = this.DropDownList6.SelectedItem.Text;
            //ml_sale.Account = this.DropDownList4.SelectedItem.Text;
            //ml_sale.Address = this.TextBox1.Text;
            //ml_sale.Customer = Convert.ToInt32(DropDownList5.SelectedValue);
            //bll_sale.Update(ml_sale);
            string Ids    = this.newId.Value.Replace(" ", "").Replace("\r\n", "");
            string Qtys   = this.newQty.Value.Replace(" ", "").Replace("\r\n", "");
            string Prices = this.newPrice.Value.Replace(" ", "").Replace("\r\n", "");

            string[] ArrIds = Ids.Split(new char[] { '|' });
            string[] ArrQty = Qtys.Split(new char[] { '|' });
            string[] ArrPri = Prices.Split(new char[] { '|' });
            for (int i = 0; i < ArrIds.Length - 1; i++)
            {
                Model.EnterStock_Detail ml_esd = new ZhangWei.Model.EnterStock_Detail();
                ml_esd.EnterStock_ID = EnterStock_ID;
                ml_esd.Product_ID    = Convert.ToInt32(ArrIds[i]);
                ml_esd.Quantity      = Convert.ToDecimal(ArrQty[i]);
                ml_esd.Price         = Convert.ToDecimal(ArrPri[i]);
                BLL.Sale_Detail bl_sd = new ZhangWei.BLL.Sale_Detail();
                //ml_sa.Sale_ID = Convert.ToInt32(Request.Params["Sale_ID"]);
                //ml_sa.Product_ID = Convert.ToInt32(ArrIds[i]);
                //ml_sa.SaleOrder_ID = 0;
                //ml_sa.Quantity = Convert.ToDecimal(ArrQty[i]);
                //ml_sa.Price = Convert.ToDecimal(ArrPri[i]);
                Model.StockPile ml_sp = new BLL.StockPile().GetModelByProId(Convert.ToInt32(ArrIds[i]), Convert.ToInt32(DropDownList1.SelectedValue));
                BLL.StockPile   bl_sp = new ZhangWei.BLL.StockPile();
                if (ml_sp == null)
                {
                    Model.Product ml_pr = new BLL.Product().GetModel(Convert.ToInt32(ArrIds[i]));
                    ml_sp                = new ZhangWei.Model.StockPile();
                    ml_sp.Product_ID     = Convert.ToInt32(ArrIds[i]);
                    ml_sp.Dept_ID        = 1;
                    ml_sp.FirstEnterDate = DateTime.Now;
                    ml_sp.LastLeaveDate  = DateTime.Now;
                    ml_sp.Price          = Convert.ToDecimal(ArrPri[i]);
                    ml_sp.Quantity       = 0;
                    ml_sp.StoreHouse_ID  = Convert.ToInt32(DropDownList1.SelectedValue);
                    ml_sp.Quantity      += Convert.ToDecimal(ArrQty[i]);
                    bl_sp.Add(ml_sp);
                }
                else
                {
                    ml_sp.Quantity += Convert.ToDecimal(ArrQty[i]);
                    //ml_sp.LastLeaveDate = DateTime.Now;
                    bl_sp.Update(ml_sp);
                }
                bl_esd.Add(ml_esd);
            }
        }
Example #3
0
        protected void BackSaleOld()
        {
            string Ids    = this.oldId.Value.Replace(" ", "").Replace("\r\n", "");
            string Qtys   = this.oldQty.Value.Replace(" ", "").Replace("\r\n", "");
            string Prices = this.oldPrice.Value.Replace(" ", "").Replace("\r\n", "");

            string[] ArrIds = Ids.Split(new char[] { '|' });
            string[] ArrQty = Qtys.Split(new char[] { '|' });
            string[] ArrPri = Prices.Split(new char[] { '|' });
            for (int i = 0; i < ArrIds.Length - 1; i++)
            {
                Model.StockPile ml_sp = new BLL.StockPile().GetModelByProId(Convert.ToInt32(ArrIds[i]), bll_sale.GetModel(Convert.ToInt32(Request.QueryString["Sale_ID"])).StoreHouse_ID);
                BLL.StockPile   bl_sp = new ZhangWei.BLL.StockPile();

                ml_sp.Quantity     += Convert.ToDecimal(ArrQty[i]);
                ml_sp.LastLeaveDate = DateTime.Now;
                bl_sp.Update(ml_sp);
            }
        }
Example #4
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     if (HiddenField1.Value == "")
     {
         Maticsoft.Common.MessageBox.Show(this, "请添加商品");
         return;
     }
     else
     {
         Model.Sale ml_sale = new ZhangWei.Model.Sale();
         ml_sale.SaleDate      = Convert.ToDateTime(TextBox1.Text);
         ml_sale.Dept_ID       = Convert.ToInt32(DropDownList1.SelectedValue);
         ml_sale.Customer      = Convert.ToInt32(DropDownList5.SelectedValue);//客户
         ml_sale.Employee_ID   = Convert.ToInt32(DropDownList2.SelectedValue);
         ml_sale.Account       = DropDownList4.SelectedValue;
         ml_sale.Address       = TextBox2.Text;
         ml_sale.GatheringWay  = DropDownList6.SelectedValue;
         ml_sale.StoreHouse_ID = Convert.ToInt32(DropDownList3.SelectedValue);
         ml_sale.TradeNo       = GetTradeNo();
         Int32    sale_id = new BLL.Sale().Add(ml_sale);
         string   Ids     = HiddenField1.Value.Replace(" ", "").Replace("\r\n", "");
         string   Qtys    = HiddenField2.Value.Replace(" ", "").Replace("\r\n", "");
         string   Prices  = HiddenField3.Value.Replace(" ", "").Replace("\r\n", "");
         string[] ArrIds  = Ids.Split(new char[] { '|' });
         string[] ArrQty  = Qtys.Split(new char[] { '|' });
         string[] ArrPri  = Prices.Split(new char[] { '|' });
         for (int i = 0; i < ArrIds.Length - 1; i++)
         {
             Model.Sale_Detail ml_sa = new ZhangWei.Model.Sale_Detail();
             BLL.Sale_Detail   bl_sd = new ZhangWei.BLL.Sale_Detail();
             ml_sa.Sale_ID    = sale_id;
             ml_sa.Product_ID = Convert.ToInt32(ArrIds[i]);
             //ml_sa.SaleOrder_ID = 0;
             ml_sa.Quantity = Convert.ToDecimal(ArrQty[i]);
             ml_sa.Price    = Convert.ToDecimal(ArrPri[i]);
             Model.StockPile ml_sp = new BLL.StockPile().GetModelByProId(Convert.ToInt32(ArrIds[i]), Convert.ToInt32(DropDownList3.SelectedValue));
             BLL.StockPile   bl_sp = new ZhangWei.BLL.StockPile();
             if (ml_sp == null)
             {
                 Model.Product ml_pr = new BLL.Product().GetModel(Convert.ToInt32(ArrIds[i]));
                 ml_sp                = new ZhangWei.Model.StockPile();
                 ml_sp.Product_ID     = Convert.ToInt32(ArrIds[i]);
                 ml_sp.Dept_ID        = Convert.ToInt32(DropDownList1.SelectedValue);
                 ml_sp.FirstEnterDate = DateTime.Now;
                 ml_sp.LastLeaveDate  = DateTime.Now;
                 ml_sp.Price          = Convert.ToDecimal(ArrPri[i]);
                 ml_sp.Quantity       = 0;
                 ml_sp.StoreHouse_ID  = Convert.ToInt32(DropDownList3.SelectedValue);
                 ml_sp.Quantity      -= Convert.ToDecimal(ArrQty[i]);
                 bl_sp.Add(ml_sp);
             }
             else
             {
                 ml_sp.Quantity     -= Convert.ToDecimal(ArrQty[i]);
                 ml_sp.LastLeaveDate = DateTime.Now;
                 bl_sp.Update(ml_sp);
             }
             bl_sd.Add(ml_sa);
         }
         Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功,单号为:" + ml_sale.TradeNo, "/Sales/SaleReport.aspx");
     }
 }
Example #5
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     if (HiddenField1.Value == "")
     {
         Maticsoft.Common.MessageBox.Show(this, "请添加商品");
         return;
     }
     else
     {
         Model.LeaveStock LeaveStock = new Model.LeaveStock();
         LeaveStock.LeaveDate       = Convert.ToDateTime(txtWriteDate.Text);
         LeaveStock.Dept_ID         = Convert.ToInt32(DropDownList1.SelectedValue);
         LeaveStock.Employee_ID     = Convert.ToInt32(DropDownList4.SelectedValue);
         LeaveStock.StoreHouse_ID   = Convert.ToInt32(DropDownList2.SelectedValue);
         LeaveStock.ToStoreHouse_ID = Convert.ToInt32(DropDownList3.SelectedValue);
         Int32    LeaveStock_ID = new BLL.LeaveStock().Add(LeaveStock);
         string   Ids           = HiddenField1.Value.Replace(" ", "").Replace("\r\n", "");
         string   Qtys          = HiddenField2.Value.Replace(" ", "").Replace("\r\n", "");
         string   Prices        = HiddenField3.Value.Replace(" ", "").Replace("\r\n", "");
         string[] ArrIds        = Ids.Split(new char[] { '|' });
         string[] ArrQty        = Qtys.Split(new char[] { '|' });
         string[] ArrPri        = Prices.Split(new char[] { '|' });
         for (int i = 0; i < ArrIds.Length - 1; i++)
         {
             Model.LeaveStock_Detail ml_ld = new Model.LeaveStock_Detail();
             BLL.LeaveStock_Detail   bl_ld = new BLL.LeaveStock_Detail();
             ml_ld.LeaveStock_ID = LeaveStock_ID;
             ml_ld.Product_ID    = Convert.ToInt32(ArrIds[i]);
             ml_ld.Quantity      = Convert.ToDecimal(ArrQty[i]);
             ml_ld.Price         = Convert.ToDecimal(ArrPri[i]);
             Model.StockPile ml_sp_out = new BLL.StockPile().GetModelByProId(Convert.ToInt32(ArrIds[i]), Convert.ToInt32(DropDownList2.SelectedValue));
             Model.StockPile ml_sp_in  = new BLL.StockPile().GetModelByProId(Convert.ToInt32(ArrIds[i]), Convert.ToInt32(DropDownList3.SelectedValue));
             BLL.StockPile   bl_sp     = new ZhangWei.BLL.StockPile();
             if (ml_sp_out == null)
             {
                 //Model.Product ml_pr = new BLL.Product().GetModel(Convert.ToInt32(ArrIds[i]));
                 ml_sp_out                = new ZhangWei.Model.StockPile();
                 ml_sp_out.Product_ID     = Convert.ToInt32(ArrIds[i]);
                 ml_sp_out.Dept_ID        = Convert.ToInt32(DropDownList1.SelectedValue);
                 ml_sp_out.FirstEnterDate = DateTime.Now;
                 ml_sp_out.LastLeaveDate  = DateTime.Now;
                 ml_sp_out.Price          = Convert.ToDecimal(ArrPri[i]);
                 ml_sp_out.Quantity       = 0;
                 ml_sp_out.StoreHouse_ID  = Convert.ToInt32(DropDownList2.SelectedValue);
                 ml_sp_out.Quantity      -= Convert.ToDecimal(ArrQty[i]);
                 bl_sp.Add(ml_sp_out);
             }
             else
             {
                 ml_sp_out.Quantity     -= Convert.ToDecimal(ArrQty[i]);
                 ml_sp_out.LastLeaveDate = DateTime.Now;
                 bl_sp.Update(ml_sp_out);
             }
             if (ml_sp_in == null)
             {
                 Model.Product ml_pr = new BLL.Product().GetModel(Convert.ToInt32(ArrIds[i]));
                 ml_sp_in                = new ZhangWei.Model.StockPile();
                 ml_sp_in.Product_ID     = Convert.ToInt32(ArrIds[i]);
                 ml_sp_in.Dept_ID        = Convert.ToInt32(DropDownList1.SelectedValue);
                 ml_sp_in.FirstEnterDate = DateTime.Now;
                 ml_sp_in.LastLeaveDate  = DateTime.Now;
                 ml_sp_in.Price          = Convert.ToDecimal(ArrPri[i]);
                 ml_sp_in.Quantity       = 0;
                 ml_sp_in.StoreHouse_ID  = Convert.ToInt32(DropDownList3.SelectedValue);
                 ml_sp_in.Quantity      += Convert.ToDecimal(ArrQty[i]);
                 bl_sp.Add(ml_sp_in);
             }
             else
             {
                 ml_sp_in.Quantity     += Convert.ToDecimal(ArrQty[i]);
                 ml_sp_in.LastLeaveDate = DateTime.Now;
                 bl_sp.Update(ml_sp_in);
             }
             bl_ld.Add(ml_ld);
         }
         Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "/warehouse/TransferRecord.aspx");
     }
 }
Example #6
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            BLL.BuyOrder   bl_bo = new BLL.BuyOrder();
            Model.BuyOrder ml_bo = bl_bo.GetModel(BuyOrder_ID);
            if (!ml_bo.Produced)//字段值为false,表示已经入过库
            {
                Maticsoft.Common.MessageBox.Show(this, "该单号已经入库,不能重复操作!");
                return;
            }
            if (DropDownList4.SelectedValue == "0")
            {
                Maticsoft.Common.MessageBox.Show(this, "请选择仓库!");
                return;
            }
            Model.EnterStock ET = new Model.EnterStock();
            ET.Dept_ID       = Convert.ToInt32(DropDownList1.SelectedValue);
            ET.Employee_ID   = Convert.ToInt32(DropDownList3.SelectedValue);
            ET.StoreHouse_ID = Convert.ToInt32(DropDownList4.SelectedValue);
            ET.EnterDate     = DateTime.Now;
            Int32 ETId = new BLL.EnterStock().Add(ET);

            foreach (RepeaterItem item in Repeater1.Items)
            {
                Label   LB1                 = (Label)item.FindControl("Label5"); //单价
                Label   LB2                 = (Label)item.FindControl("Label6"); //数量
                Label   LB3                 = (Label)item.FindControl("Label7"); //合计
                Label   LB4                 = (Label)item.FindControl("Label1"); //商品编号
                Int32   pro_id              = Convert.ToInt32(LB4.Text);
                decimal pro_qty             = Convert.ToDecimal(LB2.Text);
                Model.EnterStock_Detail esd = new Model.EnterStock_Detail();
                esd.EnterStock_ID = ETId;
                esd.Product_ID    = pro_id;
                esd.Quantity      = pro_qty;
                esd.Price         = Convert.ToDecimal(LB1.Text);
                esd.HaveInvoice   = false;
                esd.InvoiceNum    = "0000";
                BLL.EnterStock_Detail bll_esd = new BLL.EnterStock_Detail();
                bll_esd.Add(esd);
                //Model.StockPile sp = new Model.StockPile();
                BLL.StockPile   bll_sp = new BLL.StockPile();
                Model.StockPile sp     = bll_sp.GetModelByProId(pro_id, Convert.ToInt32(DropDownList4.SelectedValue));
                if (sp == null)
                {
                    sp                = new Model.StockPile();
                    sp.Dept_ID        = Convert.ToInt32(DropDownList1.SelectedValue);
                    sp.StoreHouse_ID  = Convert.ToInt32(DropDownList4.SelectedValue);
                    sp.Product_ID     = pro_id;
                    sp.FirstEnterDate = DateTime.Now;
                    sp.LastLeaveDate  = DateTime.Now;
                    sp.Quantity       = pro_qty;
                    sp.Price          = Convert.ToDecimal(LB1.Text);
                    bll_sp.Add(sp);
                }
                else
                {
                    sp.Quantity += pro_qty;
                    bll_sp.Update(sp);
                }
                ml_bo.Produced = false;
                bl_bo.Update(ml_bo);
                Maticsoft.Common.MessageBox.ShowAndRedirect(this, "入库已完成!", "/warehouse/BuyOrder/List.aspx");
            }
        }
Example #7
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            if (HiddenField1.Value == "")
            {
                Maticsoft.Common.MessageBox.Show(this, "请添加商品");
                return;
            }
            else
            {
                Model.BackStock ml_bs = new ZhangWei.Model.BackStock();
                ml_bs.BackDate      = Convert.ToDateTime(BackDate.Text);
                ml_bs.Dept_ID       = Convert.ToInt32(DropDownList1.SelectedValue);
                ml_bs.Employee_ID   = Convert.ToInt32(DropDownList2.SelectedValue);
                ml_bs.StoreHouse_ID = Convert.ToInt32(DropDownList3.SelectedValue);
                ml_bs.Remark        = this.TextBox1.Text;


                Int32    BackStock_id = new BLL.BackStock().Add(ml_bs);
                string   Ids          = HiddenField1.Value.Replace(" ", "").Replace("\r\n", "");
                string   Qtys         = HiddenField2.Value.Replace(" ", "").Replace("\r\n", "");
                string   Prices       = HiddenField3.Value.Replace(" ", "").Replace("\r\n", "");
                string[] ArrIds       = Ids.Split(new char[] { '|' });
                string[] ArrQty       = Qtys.Split(new char[] { '|' });
                string[] ArrPri       = Prices.Split(new char[] { '|' });
                for (int i = 0; i < ArrIds.Length - 1; i++)
                {
                    //Model.Sale_Detail ml_sa = new ZhangWei.Model.Sale_Detail();
                    Model.BackStock_Detail ml_bsd = new ZhangWei.Model.BackStock_Detail();
                    ml_bsd.BackStock_ID = BackStock_id;
                    ml_bsd.Product_ID   = Convert.ToInt32(ArrIds[i]);
                    ml_bsd.Price        = Convert.ToDecimal(ArrPri[i]);
                    ml_bsd.Quantity     = Convert.ToDecimal(ArrQty[i]);

                    BLL.BackStock_Detail bl_bsd = new ZhangWei.BLL.BackStock_Detail();
                    Model.StockPile      ml_sp  = new BLL.StockPile().GetModelByProId(Convert.ToInt32(ArrIds[i]), Convert.ToInt32(DropDownList3.SelectedValue));
                    BLL.StockPile        bl_sp  = new ZhangWei.BLL.StockPile();
                    if (ml_sp == null)
                    {
                        Model.Product ml_pr = new BLL.Product().GetModel(Convert.ToInt32(ArrIds[i]));
                        ml_sp                = new ZhangWei.Model.StockPile();
                        ml_sp.Product_ID     = Convert.ToInt32(ArrIds[i]);
                        ml_sp.Dept_ID        = Convert.ToInt32(DropDownList1.SelectedValue);
                        ml_sp.FirstEnterDate = DateTime.Now;
                        ml_sp.LastLeaveDate  = DateTime.Now;
                        ml_sp.Price          = Convert.ToDecimal(ArrPri[i]);
                        ml_sp.StoreHouse_ID  = Convert.ToInt32(DropDownList3.SelectedValue);
                        ml_sp.Quantity       = 0;
                        ml_sp.Quantity      -= Convert.ToDecimal(ArrQty[i]);
                        bl_sp.Add(ml_sp);
                    }
                    else
                    {
                        ml_sp.Quantity     -= Convert.ToDecimal(ArrQty[i]);
                        ml_sp.LastLeaveDate = DateTime.Now;
                        bl_sp.Update(ml_sp);
                    }
                    bl_bsd.Add(ml_bsd);
                }
                Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "/warehouse/BackStock/List.aspx");
            }
        }