Esempio n. 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtDept_ID.Text))
            {
                strErr += "Dept_ID格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtStoreHouse_ID.Text))
            {
                strErr += "StoreHouse_ID格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtProduct_ID.Text))
            {
                strErr += "Product_ID格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtFirstEnterDate.Text))
            {
                strErr += "FirstEnterDate格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtLastLeaveDate.Text))
            {
                strErr += "LastLeaveDate格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtQuantity.Text))
            {
                strErr += "Quantity格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtPrice.Text))
            {
                strErr += "Price格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      Dept_ID        = int.Parse(this.txtDept_ID.Text);
            int      StoreHouse_ID  = int.Parse(this.txtStoreHouse_ID.Text);
            int      Product_ID     = int.Parse(this.txtProduct_ID.Text);
            DateTime FirstEnterDate = DateTime.Parse(this.txtFirstEnterDate.Text);
            DateTime LastLeaveDate  = DateTime.Parse(this.txtLastLeaveDate.Text);
            int      Quantity       = int.Parse(this.txtQuantity.Text);
            decimal  Price          = decimal.Parse(this.txtPrice.Text);

            ZhangWei.Model.StockPile model = new ZhangWei.Model.StockPile();
            model.Dept_ID        = Dept_ID;
            model.StoreHouse_ID  = StoreHouse_ID;
            model.Product_ID     = Product_ID;
            model.FirstEnterDate = FirstEnterDate;
            model.LastLeaveDate  = LastLeaveDate;
            model.Quantity       = Quantity;
            model.Price          = Price;

            ZhangWei.BLL.StockPile bll = new ZhangWei.BLL.StockPile();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Esempio n. 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);
            }
        }
Esempio n. 3
0
 private void ShowInfo(int StockPile_ID)
 {
     ZhangWei.BLL.StockPile   bll   = new ZhangWei.BLL.StockPile();
     ZhangWei.Model.StockPile model = bll.GetModel(StockPile_ID);
     this.lblStockPile_ID.Text   = model.StockPile_ID.ToString();
     this.lblDept_ID.Text        = model.Dept_ID.ToString();
     this.lblStoreHouse_ID.Text  = model.StoreHouse_ID.ToString();
     this.lblProduct_ID.Text     = model.Product_ID.ToString();
     this.lblFirstEnterDate.Text = model.FirstEnterDate.ToString();
     this.lblLastLeaveDate.Text  = model.LastLeaveDate.ToString();
     this.lblQuantity.Text       = model.Quantity.ToString();
     this.lblPrice.Text          = model.Price.ToString();
 }
Esempio n. 4
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);
            }
        }
Esempio n. 5
0
        private string StockToExcel(Int32 StoreHouse_ID)
        {
            DataSet ds      = new ZhangWei.BLL.StockPile().CheckStock(StoreHouse_ID);
            string  ToExcel = new LTP.Common.DataToExcel().OutputExcel(ds.Tables[0], "库存盘点 " + DateTime.Now.ToString(), HttpContext.Current.Server.MapPath("/ExcelFiles/"), "库存盘点");

            ZhangWei.BLL.HasChecked   bl_hc = new ZhangWei.BLL.HasChecked();
            ZhangWei.Model.HasChecked ml_hc = bl_hc.GetModel(bl_hc.GetMaxId() - 1);
            DateTime dt            = DateTime.Now;
            DateTime LastCheckTime = ml_hc.Month;

            if (dt.Month > LastCheckTime.Month)
            {
                ml_hc.Month = dt;
                bl_hc.Add(ml_hc);
            }
            else
            {
                ml_hc.Month = dt;
                bl_hc.Update(ml_hc);
            }
            return(ToExcel);
        }
Esempio n. 6
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");
     }
 }
Esempio n. 7
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");
     }
 }
Esempio n. 8
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");
            }
        }