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
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.UI.WORK;
 
namespace WMS.UI.SynthesizeQuery
{
    public partial class FrmPVClistForPick : Form
    {
        long stockId = 0;
        long _taskId = 0;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="positionNames"></param>
        public FrmPVClistForPick(string positionNames, long taskId)
        {
            InitializeComponent();
            this.dataGridView1.AutoGenerateColumns = false;
            this.Text = "分拣出库-" + positionNames;
            _taskId = taskId;
            getData(positionNames);
 
        }
        private void getData(string positionNames)
        {
            try
            {
                var res = FLogin.wcsWcf.findStockList(positionNames);
                if (res.status == 200)
                {
                    dataGridView1.DataSource = res.date;
 
                }
                else
                {
                    WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, res.msg);
                    ms.Show();
                }
            }
            catch (Exception)
            {
 
            }
 
        }
 
        private void FrmPVClist_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (preview.newform.Contains(this.Text))
            {
                preview.newform.Remove(this.Text);
            }
        }
 
 
        private void button_confirm_Click(object sender, EventArgs e)
        {
 
            try
            {
                //if (this.Text.Substring(0, 1) == "G" && this.Text.Length > 4)//保存入库明细
                //{
 
                //    WMS.yunneiWCS.inStockOrderList[] modifyStockList = (WMS.yunneiWCS.inStockOrderList[])dataGridView1.DataSource;
                //    var res = FLogin.wcsWcf.modfiyInStockList(modifyStockList);
                //    int statu = res.status == 200 ? 1 : 2;
                //    WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(statu, res.msg);
                //    ms.Show();
                //    if (res.status == 200)
                //    {
                //        this.Close();
                //    }
 
                //}
                //else//保存库存明细
                //{
                WMS.yunneiWCS.productStockList[] modifyStockList = (WMS.yunneiWCS.productStockList[])dataGridView1.DataSource;
                var res = FLogin.wcsWcf.modfiyStockList(modifyStockList, _taskId);
                int statu = res.status == 200 ? 1 : 2;
                WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(statu, res.msg);
                ms.Show();
                if (res.status == 200)
                {
                    this.Close();
                }
                //}
            }
            catch (Exception)
            {
 
            }
        }
 
        private void button_cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
 
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (dataGridView1.Columns[e.ColumnIndex].Name == "delete")
                {
                    if (this.Text.Substring(0, 1) == "G" && this.Text.Length > 4)//入库单修改
                    {
                        WMS.yunneiWCS.inStockOrderList[] modifyStockList = (WMS.yunneiWCS.inStockOrderList[])dataGridView1.DataSource;
                        var modfiy = modifyStockList.ToList();
                        modfiy.RemoveAt(dataGridView1.CurrentRow.Index);
                        dataGridView1.DataSource = null;
                        dataGridView1.DataSource = modfiy.ToArray();
                    }
                    else//库存修改
                    {
                        WMS.yunneiWCS.productStockList[] modifyStockList = (WMS.yunneiWCS.productStockList[])dataGridView1.DataSource;
                        var modfiy = modifyStockList.ToList();
                        modfiy.RemoveAt(dataGridView1.CurrentRow.Index);
                        dataGridView1.DataSource = null;
                        dataGridView1.DataSource = modfiy.ToArray();
                    }
 
 
                }
 
            }
            catch (Exception ex)
            {
 
            }
        }
        /// <summary>增加序号
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        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);
 
        }
    }
}