示例#1
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);
            }
        }
示例#2
0
        protected void BindData()
        {
            this.Label3.Text = "单号:" + EnterStock_ID;
            //DataSet BuyOrder_Detail = new BLL.BuyOrder_Detail().GetProDetail(EnterStock_ID);
            Model.EnterStock ml_es = bl_es.GetModel(EnterStock_ID);
            this.DropDownList1.SelectedValue = ml_es.StoreHouse_ID.ToString();
            DataSet ds_es = bl_esd.GetEnterStock(EnterStock_ID);

            this.GridView1.DataSource = ds_es;
            this.GridView1.DataBind();
            decimal AllTot = 0;

            foreach (GridViewRow row in GridView1.Rows)
            {
                decimal price  = Convert.ToDecimal(row.Cells[4].Text);
                decimal qty    = Convert.ToDecimal(row.Cells[5].Text);
                decimal RowTot = price * qty;
                row.Cells[7].Text = RowTot.ToString();
                AllTot           += RowTot;
            }
            this.Label1.Text = AllTot.ToString();
            this.Label2.Text = Maticsoft.Common.Rmb.CmycurD(AllTot);
            string OldId    = "";
            string OldPrice = "";
            string OldQty   = "";

            for (int i = 0; i < ds_es.Tables[0].Rows.Count; i++)
            {
                OldId    += ds_es.Tables[0].Rows[i]["Product_ID"] + "|";
                OldPrice += ds_es.Tables[0].Rows[i]["Price"] + "|";
                OldQty   += ds_es.Tables[0].Rows[i]["Quantity"] + "|";
            }
            this.oldId.Value    = OldId.ToString();
            this.oldPrice.Value = OldPrice.ToString();
            this.oldQty.Value   = OldQty.ToString();
            this.newId.Value    = OldId.ToString();
            this.newPrice.Value = OldPrice.ToString();
            this.newQty.Value   = OldQty.ToString();
        }
示例#3
0
        protected void BindData()
        {
            this.Label3.Text = "单号:" + EnterStock_ID;
            Model.EnterStock ml_es = bl_es.GetModel(EnterStock_ID);
            this.Label4.Text = new BLL.StoreHouse().GetModel(ml_es.StoreHouse_ID).Address;
            DataSet ds_es = bl_esd.GetEnterStock(EnterStock_ID);

            this.GridView1.DataSource = ds_es;
            this.GridView1.DataBind();
            decimal AllTot = 0;

            foreach (GridViewRow row in GridView1.Rows)
            {
                decimal price  = Convert.ToDecimal(row.Cells[4].Text);
                decimal qty    = Convert.ToDecimal(row.Cells[5].Text);
                decimal RowTot = price * qty;
                row.Cells[7].Text = RowTot.ToString();
                AllTot           += RowTot;
            }
            this.Label1.Text = AllTot.ToString();
            this.Label2.Text = Maticsoft.Common.Rmb.CmycurD(AllTot);
        }
示例#4
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");
            }
        }