protected void bt_In_Click(object sender, EventArgs e) { Save(); foreach (GridViewRow row in gv_NotInList.Rows) { CheckBox cb_check = (CheckBox)row.FindControl("cb_Check"); if (cb_check.Checked) { PDT_StandardPriceBLL _bll; if ((int)ViewState["ID"] != 0) _bll = new PDT_StandardPriceBLL((int)ViewState["ID"]); else return; PDT_StandardPrice_Detail pd = new PDT_StandardPrice_Detail(); pd.Product = int.Parse(gv_NotInList.DataKeys[row.RowIndex]["ID"].ToString()); PDT_ProductBLL productbll = new PDT_ProductBLL(pd.Product); PDT_ProductExtInfo extinfo = productbll.GetProductExtInfo((int)Session["OwnerClient"]); if (extinfo != null) pd.Price = extinfo.SalesPrice; else pd.Price = productbll.Model.StdPrice; _bll.AddDetail(pd); } } Response.Redirect("StandardPriceDetail.aspx?ID=" + ViewState["ID"].ToString()); }
/// <summary> /// 验证指定发货明细里指定行号填写的发货数量是否超过可发货数量,并保存发货数量 /// </summary> /// <param name="Rowindex">行号</param> /// <returns>true:可以发货 false:不可发货</returns> private bool VerifyDeliveryQuantity(int Rowindex) { int applydetailid = (int)gv_OrderList.DataKeys[Rowindex]["ApplyDetailID"]; ORD_OrderApplyDetail m = new ORD_OrderApplyBLL().GetDetailModel(applydetailid); PDT_Product product = new PDT_ProductBLL(m.Product).Model; int ApplyQuantity = m.BookQuantity + m.AdjustQuantity - m.DeliveryQuantity; TextBox tbx_DeliveryQuantity_T = (TextBox)gv_OrderList.Rows[Rowindex].FindControl("tbx_DeliveryQuantity_T"); TextBox tbx_DeliveryQuantity = (TextBox)gv_OrderList.Rows[Rowindex].FindControl("tbx_DeliveryQuantity"); int DeliveryQuantity = (int.Parse(tbx_DeliveryQuantity_T.Text) * product.ConvertFactor + int.Parse(tbx_DeliveryQuantity.Text)); if (DeliveryQuantity <= ApplyQuantity) { ListTable <ORD_OrderDeliveryDetail> _details = ViewState["Details"] as ListTable <ORD_OrderDeliveryDetail>; ORD_OrderDeliveryDetail d = _details[applydetailid.ToString()]; d.DeliveryQuantity = DeliveryQuantity; d.SignInQuantity = d.DeliveryQuantity; //签收数量默认为实发数量 _details.Update(d); return(true); } else { MessageBox.Show(this, "对不起,产品:" + product.FullName + "最多只允许发放" + GetQuantityString(m.Product, ApplyQuantity)); return(false); } }
protected void bt_OK_Click(object sender, EventArgs e) { PDT_ProductBLL _Product = null; if (bt_OK.Text == "添加") { _Product = new PDT_ProductBLL(); } else { _Product = new PDT_ProductBLL((int)ViewState["ID"]); } pl_detail.GetData(_Product.Model); if (bt_OK.Text == "添加") { ViewState["ID"] = _Product.Add(); } else { _Product.Model.UpdateStaff = (int)Session["UserID"]; _Product.Update(); } Response.Redirect("ProductDetail.aspx?ID=" + ViewState["ID"].ToString() + "&IsOpponent=" + ViewState["IsOpponent"].ToString()); }
protected void ddl_LotNumber_SelectedIndexChanged(object sender, EventArgs e) { int product = 0; int.TryParse(select_Product.SelectValue, out product); //int.TryParse(RadComboBox1.SelectedValue, out product); if (product != 0 && ddl_LotNumber.SelectedValue != "") { PDT_ProductBLL productbll = new PDT_ProductBLL(product, true); if (productbll.Model == null) { return; } PDT_Product p = productbll.Model; INV_Inventory inv = INV_InventoryBLL.GetInventoryByProductAndLotNumber((int)ViewState["WareHouse"], product, ddl_LotNumber.SelectedValue); if (inv == null) { inv = INV_InventoryBLL.GetInventoryByClientAndProduct((int)ViewState["Supplier"], product, ddl_LotNumber.SelectedValue); } if (inv != null) { //获取现有库存中的批号信息 tbx_ProductDate.Text = inv.ProductDate.ToString("yyyy-MM-dd"); tbx_Quantity.Focus(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["ID"] != null) { PDT_Product product = new PDT_ProductBLL(int.Parse(Request.QueryString["ID"])).Model; if (BindProduct(product)) { BindGrid(); select_ProductCode.Enabled = false; if (product.Brand > 0) { PDT_Brand b = new PDT_BrandBLL(product.Brand).Model; Header.Attributes["WebPageSubCode"] = "IsOpponent=" + b.IsOpponent; } } } else { UploadFile1.Visible = false; } } }
protected void bt_AddProduct_Click(object sender, EventArgs e) { SVM_InventoryDifferencesBLL bll = new SVM_InventoryDifferencesBLL((int)ViewState["InventoryID"]); int product = 0; if (int.TryParse(select_Product.SelectValue, out product) && product > 0) { PDT_Product pdt = new PDT_ProductBLL(product).Model; if (pdt == null) return; int quantity = int.Parse(tbx_Q1.Text) * pdt.ConvertFactor + int.Parse(tbx_Q2.Text); if (quantity == 0) return; SVM_InventoryDifferences_Detail _detail = bll.Items.FirstOrDefault(m => m.Product == product); if (_detail == null) { _detail = new SVM_InventoryDifferences_Detail(); decimal factoryprice = 0, price = 0; PDT_ProductPriceBLL.GetPriceByClientAndType((int)ViewState["ClientID"], product, 2, out factoryprice, out price); _detail.FactoryPrice = factoryprice; _detail.Product = pdt.ID; _detail.Quantity = quantity; _detail.InventoryID = (int)ViewState["InventoryID"]; bll.AddDetail(_detail); } else { _detail.Quantity = quantity; bll.UpdateDetail(_detail); } BindGrid(); } }
protected void bt_Add_Click(object sender, EventArgs e) { int count = 0; foreach (GridViewRow row in gv_List.Rows) { CheckBox cbx = (CheckBox)row.FindControl("cbx"); if (cbx != null && cbx.Checked) { int id = (int)gv_List.DataKeys[row.RowIndex]["PDT_Product_ID"]; PDT_ProductBLL bll = new PDT_ProductBLL(id); PDT_ProductExtInfo extinfo = new PDT_ProductExtInfo(); extinfo.Code = bll.Model.FactoryCode == "" ? bll.Model.Code : bll.Model.FactoryCode; extinfo.Supplier = (int)Session["OwnerClient"]; bll.SetProductExtInfo(extinfo); count++; } } if (count > 0) { MessageBox.Show(this, string.Format("成功将{0}个商品加入经营范围!", count)); cbx_CheckAll.Checked = false; BindGrid(); } else MessageBox.Show(this, "请选择要加入经营产商品!"); }
protected void bt_OK_Click(object sender, EventArgs e) { PDT_ProductBLL _Product = null; if ((int)ViewState["ID"] == 0) { _Product = new PDT_ProductBLL(); } else { _Product = new PDT_ProductBLL((int)ViewState["ID"]); } pl_detail.GetData(_Product.Model); if ((int)ViewState["ID"] == 0) { if (_Product.Model.State == 0) _Product.Model.State = 1; if (_Product.Model.ApproveFlag == 0) _Product.Model.ApproveFlag = 1; _Product.Model.OwnerType = (int)Session["OwnerType"]; _Product.Model.OwnerClient = (int)Session["OwnerClient"]; _Product.Model.InsertStaff = (int)Session["UserID"]; ViewState["ID"] = _Product.Add(); } else { _Product.Model.UpdateStaff = (int)Session["UserID"]; _Product.Update(); } Response.Redirect("ProductList.aspx?Brand=" + _Product.Model.Brand.ToString()); }
protected int GetReplyQuantity(int appProduct, int appQuantity, int adjQuantity) { PDT_Product p = new PDT_ProductBLL(appProduct).Model; int quantity = appQuantity + adjQuantity; return quantity / p.ConvertFactor; }
protected void bt_Add_Click(object sender, EventArgs e) { int count = 0; foreach (GridViewRow row in gv_List.Rows) { CheckBox cbx = (CheckBox)row.FindControl("cbx"); if (cbx != null && cbx.Checked) { int id = (int)gv_List.DataKeys[row.RowIndex]["PDT_Product_ID"]; PDT_ProductBLL bll = new PDT_ProductBLL(id); PDT_ProductExtInfo extinfo = new PDT_ProductExtInfo(); extinfo.Code = bll.Model.FactoryCode == "" ? bll.Model.Code : bll.Model.FactoryCode; extinfo.Supplier = (int)Session["OwnerClient"]; bll.SetProductExtInfo(extinfo); count++; } } if (count > 0) { MessageBox.Show(this, string.Format("成功将{0}个商品加入经营范围!", count)); cbx_CheckAll.Checked = false; BindGrid(); } else { MessageBox.Show(this, "请选择要加入经营产商品!"); } }
protected void select_ProductCode_TextChange(object sender, MCSControls.MCSWebControls.TextChangeEventArgs e) { select_ProductCode.SelectValue = e.Code; PDT_Product _product = new PDT_ProductBLL(e.Code).Model; BindProduct(_product); }
protected void bt_Save_Click(object sender, EventArgs e) { ORD_OrderApplyDetail m = new ORD_OrderApplyBLL().GetDetailModel((int)ViewState["ID"]); PDT_Product product = new PDT_ProductBLL(m.Product).Model; if (int.Parse(tbx_ApproveQuantity_T.Text) * product.ConvertFactor > m.BookQuantity) { MessageBox.Show(this, "批复请购数量不能超过申请请购数量!"); return; } if (int.Parse(tbx_ApproveQuantity_T.Text) * product.ConvertFactor == m.BookQuantity + m.AdjustQuantity) { MessageBox.Show(this, "批复请购数量与前一次调整值相同,没有发生变化,不需要调整!"); return; } decimal OldAdjustQuantity = m.AdjustQuantity; m.AdjustQuantity = int.Parse(tbx_ApproveQuantity_T.Text) * product.ConvertFactor - m.BookQuantity; m.AdjustReason += "批复人:【" + Session["UserRealName"].ToString() + "】 批复数量:" + tbx_ApproveQuantity_T.Text + " 调整原因:" + tbx_AdjustReason.Text + "<br/>"; ORD_OrderApplyBLL bll = new ORD_OrderApplyBLL(m.ApplyID); bll.UpdateDetail(m); Session["SuccessFlag"] = true; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "message", "<script language='javascript'>window.close();</script>", false); }
protected string GetJXCQuantityString(int product, string FieldName) { int quantity = 0; DataTable dt = ViewState["Limit"] as DataTable; if (dt.Select("Product=" + product.ToString()).Count() > 0) { quantity = Convert.ToInt32(dt.Select("Product=" + product.ToString())[0][FieldName]); } PDT_Product p = new PDT_ProductBLL(product).Model; string packing1 = DictionaryBLL.GetDicCollections("PDT_Packaging")[p.TrafficPackaging.ToString()].ToString(); string packing2 = DictionaryBLL.GetDicCollections("PDT_Packaging")[p.Packaging.ToString()].ToString(); string ret = ""; if (quantity / p.ConvertFactor != 0) { ret += (quantity / p.ConvertFactor).ToString() + packing1 + " "; } if (quantity % p.ConvertFactor != 0) { ret += (quantity % p.ConvertFactor).ToString() + packing2 + " "; } return(ret); }
protected decimal GetJXCData(int product, int Quantity, decimal FactoryPrice, decimal SalesPrice, decimal RetailPrice) { switch (MCSTabControl1.SelectedIndex) { case 0: return(Quantity); case 1: return(Quantity * FactoryPrice); case 2: return(Quantity * SalesPrice); case 3: return(Quantity * RetailPrice); case 4: { decimal preice = new PDT_ProductBLL(product).Model.FactoryPrice; return(Quantity * preice); } default: return(Quantity); } }
protected void ddl_Unit_SelectedIndexChanged(object sender, EventArgs e) { int product = 0; int.TryParse(select_Product.SelectValue, out product); //int.TryParse(RadComboBox1.SelectedValue, out product); if (product != 0) { decimal price = 0; decimal.TryParse(tbx_Price.Text, out price); if (price > 0) { PDT_ProductBLL productbll = new PDT_ProductBLL(product); if (productbll.Model == null) { return; } PDT_Product p = productbll.Model; if (ddl_Unit.SelectedValue == "T") { tbx_Price.Text = (price * p.ConvertFactor).ToString("0.##"); } else { tbx_Price.Text = (price / p.ConvertFactor).ToString("0.##"); } } } }
protected int GetReplyQuantity(int appProduct, int appQuantity, int adjQuantity) { PDT_Product p = new PDT_ProductBLL(appProduct).Model; int quantity = appQuantity + adjQuantity; return(quantity / p.ConvertFactor); }
protected int GetTrafficeQuantity(int product, int quantity) { if (quantity == 0) return 0; PDT_Product p = new PDT_ProductBLL(product).Model; return quantity / p.ConvertFactor; }
protected int GetPackagingQuantity(int product, int quantity) { if (quantity == 0) return 0; PDT_Product p = new PDT_ProductBLL(product).Model; return quantity % p.ConvertFactor; }
protected void dl_packaging_SelectedIndexChanged(object sender, EventArgs e) { IList <PDT_Product> _product = PDT_ProductBLL.GetModelList("classify=" + dl_classify.SelectedValue + " and packaging=" + dl_packaging.SelectedValue + "and pdt_product.approveflag=1"); dl_product.DataSource = _product; dl_product.DataBind(); dl_product_SelectedIndexChanged(null, null); }
public Product(int ProductID, int TDP) { PDT_Product m = new PDT_ProductBLL(ProductID).Model; if (m != null) { FillModel(m, TDP); } }
public OrderDetail(PBM_OrderDetail m) { DetailID = m.ID; Product = m.Product; Price = m.Price; DiscountRate = m.DiscountRate; BookQuantity = m.BookQuantity; ConfirmQuantity = m.ConfirmQuantity; DeliveredQuantity = m.DeliveredQuantity; Remark = m.Remark; PDT_Product p = new PDT_ProductBLL(Product).Model; if (p == null) { return; } ProductName = p.ShortName; if (p.ConvertFactor == 0) { p.ConvertFactor = 1; } ConvertFactor = p.ConvertFactor; if (p.Category > 0) { CategoryName = PDT_CategoryBLL.GetFullCategoryName(p.Category); } #region 获取字典表名称 try { if (m.SalesMode > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PBM_SalseMode")[m.SalesMode.ToString()]; if (dic != null) { SalesModeName = dic.Name; } } if (p.TrafficPackaging > 0) { PackingName_T = DictionaryBLL.GetDicCollections("PDT_Packaging")[p.TrafficPackaging.ToString()].ToString(); } if (p.Packaging > 0) { PackingName_P = DictionaryBLL.GetDicCollections("PDT_Packaging")[p.Packaging.ToString()].ToString(); } } catch (System.Exception err) { LogWriter.WriteLog("MCSFramework.WSI.OrderDetail", err); } #endregion }
private void BindData() { PDT_Product m = new PDT_ProductBLL((int)ViewState["ID"]).Model; pl_detail.BindData(m); bt_OK.Text = "修改"; bt_OK.ForeColor = System.Drawing.Color.Red; }
protected void dl_product_SelectedIndexChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(dl_product.SelectedValue)) { PDT_ProductBLL _p = new PDT_ProductBLL(Int32.Parse(dl_product.SelectedValue)); tbx_SelectedProductName.Text = _p.Model.FullName; tbx_SelectedProductID.Text = dl_product.SelectedValue; } }
protected string GetPDTBrandName(int product) { PDT_Product p = new PDT_ProductBLL(product, true).Model; PDT_Brand b = new PDT_BrandBLL(p.Brand).Model; if (b != null) return b.Name; else return ""; }
protected string GetPDTClassifyName(int product) { PDT_Product p = new PDT_ProductBLL(product, true).Model; PDT_Classify c = new PDT_ClassifyBLL(p.Classify).Model; if (c != null) return c.Name; else return ""; }
protected string GetPackagingName(int product) { PDT_Product p = new PDT_ProductBLL(product).Model; if (p == null) { return(""); } return(DictionaryBLL.GetDicCollections("PDT_Packaging")[p.Packaging.ToString()].ToString()); }
protected void select_ProductCode_SelectChange(object sender, MCSControls.MCSWebControls.SelectChangeEventArgs e) { int id = 0; int.TryParse(e.SelectValue, out id); if (id > 0) { PDT_Product _product = new PDT_ProductBLL(id).Model; if (BindProduct(_product)) BindGrid(); } }
protected void bt_OK_Click(object sender, EventArgs e) { PDT_ProductBLL _Product = null; PDT_ProductExtInfo extinfo = null; if ((int)ViewState["ID"] == 0) { _Product = new PDT_ProductBLL(); } else { _Product = new PDT_ProductBLL((int)ViewState["ID"]); extinfo = _Product.GetProductExtInfo((int)Session["OwnerClient"]); } if (extinfo == null) { extinfo = new PDT_ProductExtInfo(); extinfo.Supplier = (int)Session["OwnerClient"]; } pl_detail.GetData(_Product.Model); pl_detail.GetData(extinfo); if ((int)ViewState["ID"] == 0) { _Product.Model.Category = extinfo.Category; _Product.Model.State = 1; _Product.Model.ApproveFlag = 1; _Product.Model.InsertStaff = (int)Session["UserID"]; _Product.Model.OwnerType = 3; _Product.Model.OwnerClient = (int)Session["OwnerClient"]; extinfo.InsertStaff = (int)Session["UserID"]; ViewState["ID"] = _Product.Add(); } else { if ((int)Session["OwnerClient"] == _Product.Model.OwnerClient) { _Product.Model.UpdateStaff = (int)Session["UserID"]; _Product.Update(); } } #region 将价格折算为最小单位 extinfo.BuyPrice = extinfo.BuyPrice / _Product.Model.ConvertFactor; extinfo.SalesPrice = extinfo.SalesPrice / _Product.Model.ConvertFactor; extinfo.MaxSalesPrice = extinfo.MaxSalesPrice / _Product.Model.ConvertFactor; extinfo.MinSalesPrice = extinfo.MinSalesPrice / _Product.Model.ConvertFactor; #endregion _Product.SetProductExtInfo(extinfo); Response.Redirect("ProductList.aspx?Category=" + extinfo.Category.ToString()); }
protected void tbx_LotNumber_TextChanged(object sender, EventArgs e) { int product = 0; int.TryParse(select_Product.SelectValue, out product); //int.TryParse(RadComboBox1.SelectedValue, out product); if (product != 0) { PDT_ProductBLL productbll = new PDT_ProductBLL(product, true); if (productbll.Model == null) { return; } PDT_Product p = productbll.Model; INV_Inventory inv = INV_InventoryBLL.GetInventoryByProductAndLotNumber((int)ViewState["WareHouse"], product, tbx_LotNumber.Text); if (inv != null) { //获取现有库存中的批号信息 tbx_ProductDate.Text = inv.ProductDate.ToString("yyyy-MM-dd"); if (ddl_Unit.SelectedValue == "T") { tbx_Price.Text = (inv.Price * p.ConvertFactor).ToString("0.##"); } else { tbx_Price.Text = inv.Price.ToString("0.##"); } tbx_Quantity.Focus(); } else { //根据批号尝试转换为生产日期 DateTime d = DateTime.Today; DateTime.TryParse(tbx_LotNumber.Text, out d); if (d.Year < DateTime.Today.Year - 1) { if (tbx_LotNumber.Text.Length >= 8) { DateTime.TryParse(tbx_LotNumber.Text.Substring(0, 4) + "-" + tbx_LotNumber.Text.Substring(4, 2) + "-" + tbx_LotNumber.Text.Substring(6, 2), out d); } } if (d.Year >= DateTime.Today.Year - 1) { tbx_ProductDate.Text = d.ToString("yyyy-MM-dd"); tbx_Price.Focus(); } else { tbx_ProductDate.Text = DateTime.Today.ToString("yyyy-MM-01"); } } } }
protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (ViewState["Details"] == null) return; ListTable<PBM_DeliveryDetail> Details = (ListTable<PBM_DeliveryDetail>)ViewState["Details"]; if (e.Row.RowType == DataControlRowType.DataRow) { int id = (int)((GridView)sender).DataKeys[e.Row.RowIndex]["ID"]; PBM_DeliveryDetail d = Details[id.ToString()]; if (d == null) return; PDT_Product product = new PDT_ProductBLL(d.Product, true).Model; if (product == null) return; Dictionary<string, Dictionary_Data> dic = DictionaryBLL.GetDicCollections("PDT_Packaging"); string _T = dic[product.TrafficPackaging.ToString()].Name; string _P = dic[product.Packaging.ToString()].Name; Label lbProduct = (Label)e.Row.FindControl("lbProduct"); if (lbProduct != null) lbProduct.Text = product.FullName; #region 显示产品价格包装信息 Label lb_Price = (Label)e.Row.FindControl("lb_Price"); if (lb_Price != null) { lb_Price.Text = (d.Price * product.ConvertFactor).ToString("0.##") + "元/" + _T;// +"(" + product.ConvertFactor.ToString() + _P + ")"; } #endregion #region 显示产品数量信息 Label lb_Quantity = (Label)e.Row.FindControl("lb_Quantity"); if (lb_Quantity != null) { if (d.SignInQuantity / product.ConvertFactor > 0) lb_Quantity.Text = (d.SignInQuantity / product.ConvertFactor).ToString() + _T; if (d.SignInQuantity % product.ConvertFactor > 0) lb_Quantity.Text += "" + (d.SignInQuantity % product.ConvertFactor).ToString() + _P; } #endregion #region 追加订货模式 if (d.SalesMode > 1) { Dictionary_Data dic_data = DictionaryBLL.GetDicCollections("PBM_SalseMode")[d.SalesMode.ToString()]; if (dic_data != null) lbProduct.Text += "(" + dic_data.Name + ")"; } #endregion Label lb_Fee = (Label)e.Row.FindControl("lb_Fee"); if (lb_Fee != null) lb_Fee.Text = (Math.Round(d.Price * d.ConvertFactor, 2) * d.SignInQuantity / d.ConvertFactor).ToString("0.##"); Label lbDiscountRate = (Label)e.Row.FindControl("lbDiscountRate"); if (lbDiscountRate != null) lbDiscountRate.Text = d.DiscountRate.ToString("0.##%"); } }
protected int GetTrafficeQuantity(int product, int quantity) { if (quantity == 0) { return(0); } PDT_Product p = new PDT_ProductBLL(product, true).Model; return(quantity / p.ConvertFactor); }
protected int GetPackagingQuantity(int product, int quantity) { if (quantity == 0) { return(0); } PDT_Product p = new PDT_ProductBLL(product, true).Model; return(quantity % p.ConvertFactor); }
protected void bt_AddProduct_Click(object sender, EventArgs e) { int product = 0; if (int.TryParse(select_Product.SelectValue, out product) && product > 0) { PDT_Product pdt = new PDT_ProductBLL(product).Model; if (pdt == null) { return; } int quantity = int.Parse(tbx_Q1.Text) * pdt.ConvertFactor + int.Parse(tbx_Q2.Text); DataTable dt = (DataTable)ViewState["DTDetail"]; DataRow[] drs = dt.Select("ID=" + product.ToString()); if (drs.Length > 0) { drs[0]["Quantity"] = quantity; } else { DataRow dr = dt.NewRow(); decimal factoryprice = 0, price = 0; PDT_ProductPriceBLL.GetPriceByClientAndType((int)ViewState["ClientID"], product, (int)ViewState["Type"], out factoryprice, out price); dr["ID"] = product; dr["Code"] = pdt.Code; dr["FullName"] = pdt.FullName; dr["ShortName"] = pdt.ShortName; dr["Brand"] = pdt.Brand; dr["Spec"] = pdt["Spec"]; dr["Classify"] = pdt.Classify; dr["ConvertFactor"] = pdt.ConvertFactor; dr["FactoryPrice"] = factoryprice; dr["Price"] = price; dr["Quantity"] = quantity; try { dr["BrandName"] = new PDT_BrandBLL(pdt.Brand).Model.Name; dr["ClassifyName"] = new PDT_ClassifyBLL(pdt.Classify).Model.Name; dr["TrafficPackaging"] = DictionaryBLL.GetDicCollections("PDT_Packaging")[pdt.TrafficPackaging.ToString()].Name; dr["Packaging"] = DictionaryBLL.GetDicCollections("PDT_Packaging")[pdt.Packaging.ToString()].Name; } catch { } dt.Rows.Add(dr); } BindGrid(); } }
private void BindTree() { //获取品牌 string condition = ""; if (Request.QueryString["IsOpponent"] != null) { condition = "IsOpponent=" + Request.QueryString["IsOpponent"]; } IList <PDT_Brand> _brands = PDT_BrandBLL.GetModelList(condition); dl_brand.DataSource = _brands; dl_brand.DataBind(); dl_brand.Items.Insert(0, new ListItem("请选择", "0")); dl_brand_SelectedIndexChanged(null, null); foreach (PDT_Brand brand in _brands) { TreeNode tn_brand = new TreeNode(brand.Name, brand.ID.ToString()); tr_Product.Nodes.Add(tn_brand); IList <PDT_Classify> _classifys = new PDT_ClassifyBLL()._GetModelList("PDT_Classify.Brand=" + brand.ID.ToString()); foreach (PDT_Classify classify in _classifys) { TreeNode tn_classify = new TreeNode(classify.Name, classify.ID.ToString()); tn_brand.ChildNodes.Add(tn_classify); string ConditionStr = "PDT_Product.State = 1 AND PDT_Product.Classify=" + classify.ID.ToString() + "and pdt_product.approveflag=1"; if (Request.QueryString["ExtCondition"] != null) { ConditionStr += " AND (" + Request.QueryString["ExtCondition"].Replace("\"", "").Replace('~', '\'') + ")"; } IList <PDT_Product> _products = PDT_ProductBLL.GetModelList(ConditionStr); foreach (PDT_Product product in _products) { TreeNode tn = new TreeNode(); tn.Text = product.Code + " " + product.FullName; tn.Value = product.ID.ToString(); tn_classify.ChildNodes.Add(tn); if (tn.Value == ViewState["ID"].ToString()) { tn_classify.Expand(); tn.Select(); tbx_SelectedProductID.Text = tn.Value; tbx_SelectedProductName.Text = tn.Text; } } } } }
protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { long id = (long)gv_List.DataKeys[e.Row.RowIndex]["ID"]; INV_Inventory inv = new INV_InventoryBLL(id).Model; if (inv == null) { return; } PDT_Product product = new PDT_ProductBLL(inv.Product, true).Model; if (product == null) { return; } Dictionary <string, Dictionary_Data> dic = DictionaryBLL.GetDicCollections("PDT_Packaging"); string _T = dic[product.TrafficPackaging.ToString()].Name; string _P = dic[product.Packaging.ToString()].Name; #region 显示产品价格包装信息 Label lb_Price_T = (Label)e.Row.FindControl("lb_Price_T"); if (lb_Price_T != null) { lb_Price_T.Text = (inv.Price * product.ConvertFactor).ToString("0.##") + "元 /" + _T + "(" + product.ConvertFactor.ToString() + _P + ")"; } Label lb_Price_P = (Label)e.Row.FindControl("lb_Price_P"); if (lb_Price_P != null) { lb_Price_P.Text = inv.Price.ToString("0.##") + "元 /" + _P; } #endregion #region 显示产品数量信息 Label lb_Quantity = (Label)e.Row.FindControl("lb_Quantity"); if (lb_Quantity != null) { lb_Quantity.Text = (inv.Quantity / product.ConvertFactor).ToString() + _T; if (inv.Quantity % product.ConvertFactor > 0) { lb_Quantity.Text += " " + (inv.Quantity % product.ConvertFactor).ToString() + _P; } } #endregion } else if (e.Row.RowType == DataControlRowType.Footer && ViewState["TotalInventory"] != null) { e.Row.Cells[1].Text = "小计库存额"; e.Row.Cells[5].Text = ((decimal)ViewState["TotalInventory"]).ToString("<font color=red>0.##元</font>"); } }
public TDPStandardPriceDetail(PDT_StandardPrice_Detail m) { Product = m.Product; Price = m.Price; Remark = m.Remark; PDT_Product p = new PDT_ProductBLL(m.Product).Model; if (p != null) { ProductName = p.ShortName == "" ? p.FullName : p.ShortName; } }
public Inventory(INV_Inventory m) { Product = m.Product; Quantity = m.Quantity; LotNumber = m.LotNumber; CostPrice = m.Price; PDT_Product p = new PDT_ProductBLL(Product).Model; if (p == null) { return; } ProductName = p.ShortName; PDT_Brand b = new PDT_BrandBLL(p.Brand).Model; if (b != null) { BrandName = b.Name; } if (p.Category > 0) { CategoryName = PDT_CategoryBLL.GetFullCategoryName(p.Category); } if (p.TrafficPackaging > 0) { PackingName_T = DictionaryBLL.GetDicCollections("PDT_Packaging")[p.TrafficPackaging.ToString()].ToString(); } if (p.Packaging > 0) { PackingName_P = DictionaryBLL.GetDicCollections("PDT_Packaging")[p.Packaging.ToString()].ToString(); } if (PackingName_T == "") { PackingName_T = p.TrafficPackaging.ToString(); } if (p.ConvertFactor == 0) { p.ConvertFactor = 1; } ConvertFactor = p.ConvertFactor; Quantity_T = Quantity / p.ConvertFactor; Quantity_P = Quantity % p.ConvertFactor; }
protected string GetQuantityString(int product, int quantity) { if (quantity == 0) return "0"; PDT_Product p = new PDT_ProductBLL(product).Model; string packing1 = DictionaryBLL.GetDicCollections("PDT_Packaging")[p.TrafficPackaging.ToString()].ToString(); string packing2 = DictionaryBLL.GetDicCollections("PDT_Packaging")[p.Packaging.ToString()].ToString(); string ret = ""; if (quantity / p.ConvertFactor != 0) ret += (quantity / p.ConvertFactor).ToString() + packing1 + " "; if (quantity % p.ConvertFactor != 0) ret += (quantity % p.ConvertFactor).ToString() + packing2 + " "; return ret; }
protected void bt_Add_Click(object sender, ImageClickEventArgs e) { ORD_OrderCartBLL cart = (ORD_OrderCartBLL)Session["LogisticsOrderApplyDetail"]; ImageButton b = (ImageButton)sender; TextBox tbx_BookQuantity_T = (TextBox)b.Parent.FindControl("tbx_BookQuantity_T"); GridViewRow row = (GridViewRow)tbx_BookQuantity_T.Parent.Parent; int quantity = int.Parse(tbx_BookQuantity_T.Text); int product = (int)gv_List.DataKeys[row.RowIndex]["Product"]; int factor = new PDT_ProductBLL(product, true).Model.ConvertFactor; cart.ModifyQuantity(product, quantity * factor + factor); BindGrid(); }
protected string GetPDTClassifyName(int product) { PDT_Product p = new PDT_ProductBLL(product, true).Model; PDT_Classify c = new PDT_ClassifyBLL(p.Classify).Model; if (c != null) { return(c.Name); } else { return(""); } }
protected string GetPackagingName(int product) { string a = "个"; PDT_Product p = new PDT_ProductBLL(product, true).Model; if (p.Packaging < 1) { return(a); //零售包装为空时,默认“个” } else { return(DictionaryBLL.GetDicCollections("PDT_Packaging")[p.Packaging.ToString()].ToString()); } }
protected string GetPDTBrandName(int product) { PDT_Product p = new PDT_ProductBLL(product, true).Model; PDT_Brand b = new PDT_BrandBLL(p.Brand).Model; if (b != null) { return(b.Name); } else { return(""); } }
protected void bt_AddProduct_Click(object sender, EventArgs e) { int product = 0; if (int.TryParse(select_Product.SelectValue, out product) && product > 0) { PDT_Product pdt = new PDT_ProductBLL(product).Model; if (pdt == null) return; int quantity = int.Parse(tbx_Q1.Text) * pdt.ConvertFactor + int.Parse(tbx_Q2.Text); DataTable dt = (DataTable)ViewState["DTDetail"]; DataRow[] drs = dt.Select("ID=" + product.ToString()); if (drs.Length > 0) { drs[0]["Quantity"] = quantity; } else { DataRow dr = dt.NewRow(); decimal factoryprice = 0, price = 0; PDT_ProductPriceBLL.GetPriceByClientAndType((int)ViewState["ClientID"], product, (int)ViewState["Type"], out factoryprice, out price); dr["ID"] = product; dr["Code"] = pdt.Code; dr["FullName"] = pdt.FullName; dr["ShortName"] = pdt.ShortName; dr["Brand"] = pdt.Brand; dr["Spec"] = pdt["Spec"]; dr["Classify"] = pdt.Classify; dr["ConvertFactor"] = pdt.ConvertFactor; dr["FactoryPrice"] = factoryprice; dr["Price"] = price; dr["Quantity"] = quantity; try { dr["BrandName"] = new PDT_BrandBLL(pdt.Brand).Model.Name; dr["ClassifyName"] = new PDT_ClassifyBLL(pdt.Classify).Model.Name; dr["TrafficPackaging"] = DictionaryBLL.GetDicCollections("PDT_Packaging")[pdt.TrafficPackaging.ToString()].Name; dr["Packaging"] = DictionaryBLL.GetDicCollections("PDT_Packaging")[pdt.Packaging.ToString()].Name; } catch { } dt.Rows.Add(dr); } BindGrid(); } }
private void BindData() { ORD_OrderApplyDetail m = new ORD_OrderApplyBLL().GetDetailModel((int)ViewState["ID"]); PDT_Product product = new PDT_ProductBLL(m.Product).Model; lb_Product.Text = product.FullName; img_Product.ImageUrl = ATMT_AttachmentBLL.GetFirstPreviewPicture(11, m.Product); if (img_Product.ImageUrl == "") img_Product.Visible = false; lb_Package1.Text = DictionaryBLL.GetDicCollections("PDT_Packaging")[product.TrafficPackaging.ToString()].Name; lb_Package2.Text = lb_Package1.Text; lb_BookQuantity_T.Text = (m.BookQuantity / product.ConvertFactor).ToString(); tbx_ApproveQuantity_T.Text = ((m.BookQuantity + m.AdjustQuantity) / product.ConvertFactor).ToString(); }
protected string GetJXCQuantityString(int product, string FieldName) { int quantity = 0; DataTable dt = ViewState["Limit"] as DataTable; if (dt.Select("Product=" + product.ToString()).Count() > 0) { quantity = Convert.ToInt32(dt.Select("Product=" + product.ToString())[0][FieldName]); } PDT_Product p = new PDT_ProductBLL(product).Model; string packing1 = DictionaryBLL.GetDicCollections("PDT_Packaging")[p.TrafficPackaging.ToString()].ToString(); string packing2 = DictionaryBLL.GetDicCollections("PDT_Packaging")[p.Packaging.ToString()].ToString(); string ret = ""; if (quantity / p.ConvertFactor != 0) ret += (quantity / p.ConvertFactor).ToString() + packing1 + " "; if (quantity % p.ConvertFactor != 0) ret += (quantity % p.ConvertFactor).ToString() + packing2 + " "; return ret; }
protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { long id = (long)gv_List.DataKeys[e.Row.RowIndex]["ID"]; INV_Inventory inv = new INV_InventoryBLL(id).Model; if (inv == null) return; PDT_Product product = new PDT_ProductBLL(inv.Product, true).Model; if (product == null) return; Dictionary<string, Dictionary_Data> dic = DictionaryBLL.GetDicCollections("PDT_Packaging"); string _T = dic[product.TrafficPackaging.ToString()].Name; string _P = dic[product.Packaging.ToString()].Name; #region 显示产品价格包装信息 Label lb_Price_T = (Label)e.Row.FindControl("lb_Price_T"); if (lb_Price_T != null) { lb_Price_T.Text = (inv.Price * product.ConvertFactor).ToString("0.##") + "元 /" + _T + "(" + product.ConvertFactor.ToString() + _P + ")"; } Label lb_Price_P = (Label)e.Row.FindControl("lb_Price_P"); if (lb_Price_P != null) { lb_Price_P.Text = inv.Price.ToString("0.##") + "元 /" + _P; } #endregion #region 显示产品数量信息 Label lb_Quantity = (Label)e.Row.FindControl("lb_Quantity"); if (lb_Quantity != null) { lb_Quantity.Text = (inv.Quantity / product.ConvertFactor).ToString() + _T; if (inv.Quantity % product.ConvertFactor > 0) lb_Quantity.Text += " " + (inv.Quantity % product.ConvertFactor).ToString() + _P; } #endregion } else if (e.Row.RowType == DataControlRowType.Footer && ViewState["TotalInventory"] != null) { e.Row.Cells[1].Text = "小计库存额"; e.Row.Cells[5].Text = ((decimal)ViewState["TotalInventory"]).ToString("<font color=red>0.##元</font>"); } }
protected decimal GetJXCData(int product,int Quantity, decimal FactoryPrice, decimal SalesPrice, decimal RetailPrice) { switch (MCSTabControl1.SelectedIndex) { case 0: return Quantity; case 1: return Quantity * FactoryPrice; case 2: return Quantity * SalesPrice; case 3: return Quantity * RetailPrice; case 4: { decimal preice = new PDT_ProductBLL(product).Model.FactoryPrice; return Quantity * preice; } default: return Quantity; } }
private void BindTree() { //获取品牌 string condition = ""; if (Request.QueryString["IsOpponent"] != null) condition = "IsOpponent=" + Request.QueryString["IsOpponent"]; IList<PDT_Brand> _brands = PDT_BrandBLL.GetModelList(condition); foreach (PDT_Brand brand in _brands) { TreeNode tn_brand = new TreeNode(brand.Name, brand.ID.ToString()); tr_Product.Nodes.Add(tn_brand); IList<PDT_Classify> _classifys = new PDT_ClassifyBLL()._GetModelList("PDT_Classify.Brand=" + brand.ID.ToString()); foreach (PDT_Classify classify in _classifys) { TreeNode tn_classify = new TreeNode(classify.Name, classify.ID.ToString()); tn_brand.ChildNodes.Add(tn_classify); IList<PDT_Product> _products = new PDT_ProductBLL()._GetModelList("PDT_Product.State = 1 AND PDT_Product.Classify=" + classify.ID.ToString()); foreach (PDT_Product product in _products) { TreeNode tn = new TreeNode(); tn.Text = product.Code + " " + product.FullName; tn.Value = product.Code; tn_classify.ChildNodes.Add(tn); if (tn.Value == ViewState["ERPCode"].ToString()) { tn_classify.Expand(); tn.Select(); tbx_SelectedProductCode.Text = tn.Value; tbx_SelectedProductName.Text = tn.Text; } } } } }
protected void bt_AddAll_Click(object sender, EventArgs e) { string ConditionStr = " PDT_Product.ID NOT IN (SELECT Product FROM MCS_PUB.dbo.PDT_ProductExtInfo WHERE Supplier=" + Session["OwnerClient"].ToString() + ")"; if (tr_List.SelectedValue != "" && tr_List.SelectedValue != "1") { string _categoryids = ""; DataTable dt = TreeTableBLL.GetAllChildByNodes("MCS_Pub.dbo.PDT_Category", "ID", "SuperID", tr_List.SelectedValue); for (int i = 0; i < dt.Rows.Count; i++) { _categoryids += dt.Rows[i]["ID"].ToString() + ","; } _categoryids += tr_List.SelectedValue; ConditionStr += " AND PDT_Product.Category IN (" + _categoryids + ")"; } int count = 0; IList<PDT_Product> product = PDT_ProductBLL.GetModelList(ConditionStr); foreach (PDT_Product p in product) { int id = p.ID; PDT_ProductBLL bll = new PDT_ProductBLL(id); PDT_ProductExtInfo extinfo = new PDT_ProductExtInfo(); extinfo.Code = bll.Model.FactoryCode == "" ? bll.Model.Code : bll.Model.FactoryCode; extinfo.Supplier = (int)Session["OwnerClient"]; bll.SetProductExtInfo(extinfo); count++; } if (count > 0) { MessageBox.Show(this, string.Format("成功将{0}个商品加入经营范围!", count)); BindGrid(); } else MessageBox.Show(this, "请选择要加入经营产商品!"); }
protected void bt_SaveAdjust_Click(object sender, EventArgs e) { if ((int)ViewState["ID"] != 0) { ListTable<ORD_OrderApplyDetail> _details = ViewState["Details"] as ListTable<ORD_OrderApplyDetail>; foreach (GridViewRow row in gv_ProductList.Rows) { int productid = (int)gv_ProductList.DataKeys[row.RowIndex]["Product"]; ORD_OrderApplyDetail m = _details[productid.ToString()]; PDT_Product product = new PDT_ProductBLL(m.Product).Model; TextBox tbx_AdjustQuantity_T = (TextBox)row.FindControl("tbx_AdjustQuantity_T"); TextBox tbx_AdjustQuantity = (TextBox)row.FindControl("tbx_AdjustQuantity"); int quantity = int.Parse(tbx_AdjustQuantity_T.Text) * product.ConvertFactor + int.Parse(tbx_AdjustQuantity.Text); if (m.BookQuantity + quantity < 0) { MessageBox.Show(this, "对不起,扣减的调整数量不能大于定货数量!"); return; } m.AdjustQuantity = quantity; m.AdjustReason = ((TextBox)row.FindControl("tbx_AdjustReason")).Text; _details.Update(m); } ORD_OrderApplyBLL bll = new ORD_OrderApplyBLL((int)ViewState["ID"]); bll.Items = _details.GetListItem(ItemState.Modified); bll.UpdateDetail(); BindGrid(); } }
protected void select_Product_TextChange(object sender, MCSControls.MCSWebControls.TextChangeEventArgs e) { PDT_ProductExtInfo p = PDT_ProductExtInfoBLL.GetProductExtInfo_ByCode((int)Session["OwnerClient"], e.Code); if (p != null) { PDT_ProductBLL productbll = new PDT_ProductBLL(p.Product); if (productbll.Model == null) return; select_Product.SelectValue = p.Product.ToString(); select_Product.SelectText = productbll.Model.FullName; select_Product_SelectChange(null, null); tbx_Quantity.Text = ""; tbx_Quantity.Focus(); } }
protected void select_Product_SelectChange(object sender, MCSControls.MCSWebControls.SelectChangeEventArgs e) { int product = 0; int.TryParse(select_Product.SelectValue, out product); //int.TryParse(RadComboBox1.SelectedValue, out product); if (product != 0) { PDT_ProductBLL productbll = new PDT_ProductBLL(product); if (productbll.Model == null) return; PDT_Product p = productbll.Model; Dictionary<string, Dictionary_Data> dic = DictionaryBLL.GetDicCollections("PDT_Packaging"); string _T = dic[p.TrafficPackaging.ToString()].Name; string _P = dic[p.Packaging.ToString()].Name; #region 显示批号及库存信息 ddl_LotNumber.Items.Clear(); //调拨,仅获取指定仓库可销售的批号 foreach (INV_Inventory item in INV_InventoryBLL.GetInventoryListByProduct((int)ViewState["WareHouse"], product).OrderBy(t => t.LotNumber)) { string invstr = (item.Quantity / p.ConvertFactor).ToString() + _T; if (item.Quantity % p.ConvertFactor > 0) invstr += " " + (item.Quantity % p.ConvertFactor).ToString() + _P; ddl_LotNumber.Items.Add(new ListItem((item.LotNumber == "" ? "无批号" : item.LotNumber) + " -【库存量:" + invstr + "】", item.LotNumber)); } if (ddl_LotNumber.Items.Count == 0) { ddl_LotNumber.Items.Add(new ListItem("无批号", "")); } ddl_LotNumber_SelectedIndexChanged(null, null); #endregion #region 显示产品包装信息 lb_TrafficPackagingName.Text = "元/" + _T + "(" + p.ConvertFactor.ToString() + _P + ")"; #endregion #region 调拨价格为商品默认销售价 decimal saleprice = 0; try { saleprice = productbll.GetProductExtInfo((int)Session["OwnerClient"]).SalesPrice; } catch { } if (saleprice > 0) { if (ddl_Unit.SelectedValue == "T") tbx_Price.Text = (saleprice * p.ConvertFactor).ToString("0.###"); else tbx_Price.Text = saleprice.ToString("0.###"); tbx_Price.Enabled = false; } else { tbx_Price.Text = "0"; tbx_Price.Enabled = true; } #endregion } }
protected void gv_List_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { if (ViewState["Details"] == null) return; ListTable<PBM_DeliveryDetail> Details = (ListTable<PBM_DeliveryDetail>)ViewState["Details"]; int id = (int)gv_List.DataKeys[e.NewSelectedIndex]["ID"]; PBM_DeliveryDetail d = Details[id.ToString()]; PDT_Product product = new PDT_ProductBLL(d.Product, true).Model; if (product == null) return; //RadComboBox1.SelectedValue = d.Product.ToString(); //RadComboBox1.Text = product.FullName; //RadComboBox1_SelectedIndexChanged(null, null); select_Product.SelectText = product.FullName; select_Product.SelectValue = product.ID.ToString(); select_Product_SelectChange(null, null); if (ddl_LotNumber.Items.FindByValue(d.LotNumber) != null) ddl_LotNumber.SelectedValue = d.LotNumber; if (d.DeliveryQuantity % product.ConvertFactor == 0) { ddl_Unit.SelectedValue = "T"; tbx_Price.Text = (d.Price * product.ConvertFactor).ToString("0.##"); tbx_Quantity.Text = (d.DeliveryQuantity / product.ConvertFactor).ToString(); } else { ddl_Unit.SelectedValue = "P"; tbx_Price.Text = d.Price.ToString("0.##"); tbx_Quantity.Text = d.DeliveryQuantity.ToString(); } ViewState["SelectedDetail"] = d; bt_AddDetail.Text = "修 改"; }