username@email.com
2025-04-22 277cffdd657197fbd72444ef24a99dde7a469011
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.Model;
using CY.BLL.OA;
using CY.Infrastructure.Common;
using CY.Infrastructure.Query;
using CY.BLL.Sys;
using System.Data;
using CY.BLL;
 
namespace CY.WebForm.Pages.procurement
{
    public partial class ProcurementList : BasePage
    {
        Sys_DictionaryBLL _Sys_DictionaryBLL = null;
        OA_SuppliersBLL _OA_SuppliersBLL = null;
        OA_CommodityBLL _OA_CommodityBLL = null;
        OA_GoodsInfoBLL _OA_GoodsInfoBLL = null;
        OA_ProcurementBLL _OA_ProcurementBLL = null;
        OA_Procurement Procuremet = null;
        OA_StaffBLL bll_OA_StaffBLL = null;
 
        public ProcurementList()
        {
            bll_OA_StaffBLL = new OA_StaffBLL();
            Procuremet = new OA_Procurement();
            _OA_CommodityBLL = new OA_CommodityBLL();
            _Sys_DictionaryBLL = new Sys_DictionaryBLL();
            _OA_SuppliersBLL = new OA_SuppliersBLL();
            _OA_GoodsInfoBLL = new OA_GoodsInfoBLL();
            _OA_ProcurementBLL = new OA_ProcurementBLL();
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
 
            UCPager1.AspNetPager.PageChanged += AspNetPager1_PageChanged;
            if (!IsPostBack)
            {
            }
 
            if (!IsPostBack)
            {
 
                if (Request["Keyid"].ToInt32() > 0) //如果keyid>0 则删除对应对象
                {
                    Procuremet = _OA_ProcurementBLL.SelectSingleModel(Request["Keyid"].ToString2());
                    if (_OA_ProcurementBLL.DeleteModel(Procuremet))
                    {
                        JavaScript.MessageBox("删除成功", this);
                        InitialData();
                        BindList();
                    }
                    else
                    {
                        JavaScript.MessageBox("删除失败", this);
                        InitialData();
                        BindList();
                    }
                }
                else
                {
 
                    InitialData();
                    BindList();
                }
            }
 
        }
 
        protected void BindList()
        {
            Pagination pa = new Pagination();
            pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex;
            pa.PageSize = UCPager1.AspNetPager.PageSize;
            ReProcurentList.DataSource = _OA_ProcurementBLL.getModelList(pa, CurrentUser.MemberId, this.selOpretor.Value, this.selPurchaseStatus.Value, this.selClearingStatus.Value, this.selSuppliers.Value, this.selGoodsName.Value, this.dwCommity.SelectedValue, this.txtRegTimeStart.Value.ToDateTime2(), this.txtRegTimeEnd.Value.ToDateTime2(), this.txtBrandName.Value, this.txtPaperWeight.Value);
            ReProcurentList.DataBind();
 
            UCPager1.AspNetPager.RecordCount = pa.RecordCount;
        }
 
        protected void InitialData()
        {
            //采购状态
            this.selPurchaseStatus.DataSource = _Sys_DictionaryBLL.GetDataByType("采购状态");
            this.selPurchaseStatus.DataBind();
            this.selPurchaseStatus.Items.Insert(0, new ListItem("全部", ""));
            this.selPurchaseStatus.Value = "200";
 
            //结账状态
            this.selClearingStatus.DataSource = _Sys_DictionaryBLL.GetDataByType("结账状态");
            this.selClearingStatus.DataBind();
            this.selClearingStatus.Items.Insert(0, new ListItem("全部", ""));
 
            //供应商
            this.selSuppliers.DataSource = _OA_SuppliersBLL.getSupplierTable(CurrentUser.MemberId);
            this.selSuppliers.DataBind();
            this.selSuppliers.Items.Insert(0, new ListItem("全部", ""));
 
            //产品类别
            DataTable ds = _OA_CommodityBLL.SelectModelPage(CurrentUser.MemberId, "", "true");
            GetDataByLevel(this.dwCommity, ds, 0, 0);
            this.dwCommity.Items.Insert(0, new ListItem("全部", ""));
        }
 
        public static void GetDataByLevel(System.Web.UI.WebControls.DropDownList dwCommity, DataTable data, int parentId, int level)
        {
            DataRow[] result = data.Select(string.Format("ParentId={0}", parentId));
            int i = -1;
            while (++i < result.Length)
            {
                dwCommity.Items.Add(new ListItem(GetSplitChar(level) + result[i]["CommodityName"].ToString2(), result[i]["Keyid"].ToString2()));
                GetDataByLevel(dwCommity, data, result[i]["Keyid"].ToInt32().Value, level + 1);
            }
        }
 
        public static string GetSplitChar(int level)
        {
            string splitchar = "";
            int i = -1;
            while (++i < level)
            {
                splitchar += ".";
            }
            return splitchar;
        }
 
        protected void AspNetPager1_PageChanged(object src, EventArgs e)
        {
            BindList();
        }
 
        protected void btn_Register_Click(object sender, EventArgs e)
        {
            BindList();
        }
 
        protected void dwCommity_SelectedIndexChanged(object sender, EventArgs e)
        {
            //货品名称
            DataTable ds = _OA_GoodsInfoBLL.SlectModleByCommity(dwCommity.SelectedValue.ToString(), CurrentUser.MemberId);
            if (ds.Rows.Count > 0)
            {
                this.selGoodsName.Items.Clear();
                this.selGoodsName.DataSource = ds;
                this.selGoodsName.DataTextField = "GoodsName";
                this.selGoodsName.DataValueField = "Keyid";
                this.selGoodsName.DataBind();
                this.selGoodsName.Items.Insert(0, new ListItem("全部", ""));
            }
            else
            {
                this.selGoodsName.Items.Clear();
                this.selGoodsName.Items.Insert(0, new ListItem("全部", ""));
            }
            BindList();
        }
    }
}