schangxiang@126.com
2025-09-01 92fea996bf287e90c590cb30c0b1aac5969d0f17
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
using sunui.forms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WMS.Model;
using WMS.Untils;
using WMS.yunneiWCS;
 
namespace WMS.UI.WORK
{
    public partial class outStockCode : Form
    {
        WMS.yunneiWCS.v_outStockList param = new yunneiWCS.v_outStockList();
        int pagaSize = 20;
        paging paga = new paging();
        public outStockCode()
        {
            InitializeComponent();
            this.dataGridView1.AutoGenerateColumns = false;
        }
 
        /// <summary>
        /// 加载下拉数据
        /// </summary>
        private void LoadSelectData()
        {
            var fr = FLogin.wcsWcf.GetSelectList("version");
            var versionList = fr.resData;
            this.uiComboBox_version.Items.Clear();
            this.uiComboBox_version.Items.AddRange(versionList);
 
            //物料编码
            var fr_materialCode = FLogin.wcsWcf.GetSelectList("materialCode");
            var materialCodeList = fr_materialCode.resData;
            this.uiComboBox_materialCode.Items.Clear();
            this.uiComboBox_materialCode.Items.AddRange(materialCodeList);
 
            //物料名称
            var fr_materialName = FLogin.wcsWcf.GetSelectList("materialName");
            var materialNameList = fr_materialName.resData;
            this.uiComboBox_materialName.Items.Clear();
            this.uiComboBox_materialName.Items.AddRange(materialNameList);
 
 
        }
        private void findData()
        {
            try
            {
                #region 判断有没有输入筛选条件 uiTextBox_positionName
                //param.positionName = uiTextBox_positionName.Text.Trim() != "" ? uiTextBox_positionName.Text.Trim() : "";//库位名称
                param.sourcePlace = uiTextBox_sourcePlace.Text.Trim() != "" ? uiTextBox_sourcePlace.Text.Trim() : "";//起点
                param.toPlace = uiTextBox_toPlace.Text.Trim() != "" ? uiTextBox_toPlace.Text.Trim() : "";//目标点
                param.materialName = uiComboBox_materialName.Text.Trim() != "" ? uiComboBox_materialName.Text.Trim() : "";//物料名称
                param.materialCode = uiComboBox_materialCode.Text.Trim() != "" ? uiComboBox_materialCode.Text.Trim() : "";//物料编码
                param.containerCode = uiTextBox_containerCode.Text.Trim() != "" ? uiTextBox_containerCode.Text.Trim() : "";//托盘号
                param.version = uiComboBox_version.Text.Trim() != "" ? uiComboBox_version.Text.Trim() : "";//机型
                param.supplier = uiTextBox_supplier.Text.Trim() != "" ? uiTextBox_supplier.Text.Trim() : "";//供应商
                //param.status = Convert.ToByte(uiComboBox_status.SelectedIndex);
                #endregion
 
                //时间
                paga.startDateTime = string.IsNullOrEmpty(uiDatetimePicker_start.Text) ? new DateTime() : Convert.ToDateTime(uiDatetimePicker_start.Text);
                paga.endDateTime = string.IsNullOrEmpty(uiDatetimePicker_end.Text) ? new DateTime() : Convert.ToDateTime(uiDatetimePicker_end.Text);
 
                // var aa = toolStripComboBox1.SelectedItem;
                //var res = FLogin.wcsWcf.getOutStockOrder(paga, materialName, materialCode);
                var res = FLogin.wcsWcf.getOutStockOrderNewVersion(paga, param);
                if (res.status == 200)
                {
 
                    this.dataGridView1.DataSource = res.date;
                    this.toolStripLabel5.Text = "/" + res.total;
                    if (res.total == 1)
                    {
                        toolStripLabel2.Enabled = false;
                        toolStripTextBox1.Enabled = false;
                        toolStripLabel1.Enabled = false;
                        toolStripLabel4.Enabled = false;
                        toolStripLabel3.Enabled = false;
                    }
                    else
                    {
                        toolStripLabel3.Enabled = true;
                        toolStripLabel2.Enabled = true;
                        toolStripTextBox1.Enabled = true;
                        toolStripLabel4.Enabled = paga.pagenum == 1 ? false : true;
                    }
                }
                else
                {
                    MessageBox.Show("获取失败");
                }
            }
            catch (Exception ex)
            {
                WZ.Useful.Commons.LogTextHelper.WriteLine("FormPlaceSetting", "findData", ex.ToString());
            }
 
        }
        private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
        {
            SolidBrush b = new SolidBrush(this.dataGridView1.RowHeadersDefaultCellStyle.ForeColor);
            e.Graphics.DrawString((e.RowIndex + 1).ToString(System.Globalization.CultureInfo.CurrentUICulture), this.dataGridView1.DefaultCellStyle.Font, b, e.RowBounds.Location.X + 20, e.RowBounds.Location.Y + 4);
 
        }
 
        private void outStockCode_Load(object sender, EventArgs e)
        {
            this.toolStripComboBox1.SelectedIndex = 1;
 
            this.dataGridView1.Columns["createTime"].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:ss";
            FormHelper.DataGridViewSelfAdaptionWidth(this.dataGridView1);
 
            LoadSelectData();
            paging paga = new paging();
            paga.pagenum = 1;
            paga.pagesize = pagaSize;
            // findData(paga, materialCode, materialName);
            toolStripTextBox1.Text = "1";
            toolStripLabel1.Enabled = false;
            button_reset_Click(null, null);
        }
        /// <summary>复位
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_reset_Click(object sender, EventArgs e)
        {
            this.uiTextBox_sourcePlace.Text = "";
            this.uiTextBox_toPlace.Text = "";
            this.uiTextBox_supplier.Text = "";
            this.uiComboBox_version.Text = "";
            this.uiTextBox_containerCode.Text = "";
            uiComboBox_materialName.Text = "";
            uiComboBox_materialCode.Text = "";
            uiDatetimePicker_start.Text = DateTimeHelper.ConvertToString(DateTime.Now.AddDays(-30));
            uiDatetimePicker_end.Text = DateTimeHelper.ConvertToString(DateTime.Now.AddDays(1));
 
        
            paga.pagenum = 1;
            paga.pagesize = pagaSize;
            findData();
            toolStripTextBox1.Text = "1";
            toolStripLabel1.Enabled = false;
 
            this.dataGridView1.ReadOnly = true;
        }
        /// <summary>查找
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_find_Click(object sender, EventArgs e)
        {
            //materialCode = textBox_code.Text.Trim();
            //materialName = textBox_name.Text.Trim();
            paging paga = new paging();
            paga.pagenum = 1;
            paga.pagesize = pagaSize;
            findData();
        }
 
        private void toolStripLabel3_Click(object sender, EventArgs e)
        {
 
        }
 
        private void toolStripLabel2_Click(object sender, EventArgs e)
        {
 
        }
 
        private void toolStripLabel1_Click(object sender, EventArgs e)
        {
 
        }
 
        private void toolStripLabel3_Click_1(object sender, EventArgs e)
        {
            try
            {
                int sizetatol = 0;
                int a = this.toolStripLabel5.Text.Trim().Length;
                string size = this.toolStripLabel5.Text.Trim().Substring(1, a - 1);
                int.TryParse(size, out sizetatol);
 
                paga.pagenum = sizetatol;
                paga.pagesize = pagaSize;
                findData();
                toolStripLabel3.Enabled = false;
                toolStripLabel4.Enabled = true;
                toolStripTextBox1.Text = sizetatol.ToString();
                toolStripTextBox1.Enabled = true;
                toolStripLabel1.Enabled = true;
                toolStripLabel2.Enabled = false;
 
            }
            catch (Exception)
            {
 
            }
        }
 
        private void toolStripLabel2_Click_1(object sender, EventArgs e)
        {
            try
            {
 
                int numPapg = 0;
                int.TryParse(toolStripTextBox1.Text.Trim(), out numPapg);
                numPapg++;
                this.toolStripTextBox1.Text = numPapg.ToString();
                int sizetatol = 0;
                int a = this.toolStripLabel5.Text.Trim().Length;
                string size = this.toolStripLabel5.Text.Trim().Substring(1, a - 1);
                int.TryParse(size, out sizetatol);
                toolStripLabel4.Enabled = true;
                if (numPapg <= sizetatol)
                {
 
                    paga.pagenum = numPapg;
                    paga.pagesize = pagaSize;
                    findData();
                    toolStripLabel1.Enabled = true;
                    if (numPapg == sizetatol)
                    {
                        toolStripLabel2.Enabled = false;
                        toolStripLabel3.Enabled = false;
                    }
                }
                else
                {
                    toolStripTextBox1.Text = "1";
                    WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, "请输入数字,并大于1且不大于总页数");
                    ms.Show();
                }
 
            }
            catch (Exception)
            {
 
            }
        }
 
        private void toolStripLabel1_Click_1(object sender, EventArgs e)
        {
            try
            {
 
                int numPapg = 0;
                int.TryParse(toolStripTextBox1.Text.Trim(), out numPapg);
                numPapg--;
                toolStripTextBox1.Text = numPapg.ToString();
                int sizetatol = 0;
                int a = this.toolStripLabel5.Text.Trim().Length;
                string size = this.toolStripLabel5.Text.Trim().Substring(1, a - 1);
                int.TryParse(size, out sizetatol);
 
                if (numPapg <= sizetatol)
                {
 
 
                    paga.pagenum = numPapg;
                    paga.pagesize = pagaSize;
                    findData();
                    toolStripLabel2.Enabled = true;
                    toolStripLabel3.Enabled = true;
                    if (numPapg == 1)
                    {
                        toolStripLabel1.Enabled = false;
                    }
                }
                else
                {
                    toolStripTextBox1.Text = "1";
                    WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, "请输入数字,并大于1且不大于总页数");
                    ms.Show();
                }
 
            }
            catch (Exception)
            {
 
            }
        }
 
        private void toolStripLabel4_Click(object sender, EventArgs e)
        {
            try
            {
 
                paga.pagenum = 1;
                paga.pagesize = pagaSize;
                findData();
                toolStripLabel4.Enabled = false;
                toolStripLabel3.Enabled = true;
                toolStripTextBox1.Text = "1";
                toolStripTextBox1.Enabled = true;
                toolStripLabel1.Enabled = false;
                toolStripLabel2.Enabled = true;
            }
            catch (Exception)
            {
            }
        }
 
          /// <summary>每页数量改变
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripComboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                pagaSize = (toolStripComboBox1.SelectedIndex + 1) * 10;
 
                paga.pagenum = 1;
                paga.pagesize = pagaSize;
                findData();
                toolStripTextBox1.Text = "1";
            }
            catch (Exception)
            {
 
            }
        }
    }
}