265 lines
		
	
	
		
			8.1 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			265 lines
		
	
	
		
			8.1 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using System.ComponentModel;
							 | 
						|||
| 
								 | 
							
								using System.Data;
							 | 
						|||
| 
								 | 
							
								using System.Drawing;
							 | 
						|||
| 
								 | 
							
								using System.Text;
							 | 
						|||
| 
								 | 
							
								using System.Windows.Forms;
							 | 
						|||
| 
								 | 
							
								 
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace DeiNiu.Wms.CE
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class BatchStockOut4ValidList   : basicForm 
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								         // WmsOutPickRequestClient client { get; set; }
							 | 
						|||
| 
								 | 
							
								          //v_stockOutBatchPickOrder4Wince
							 | 
						|||
| 
								 | 
							
								          //v_stockOutBatchPickDetail4Wince
							 | 
						|||
| 
								 | 
							
								          public BatchStockOut4ValidList()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            InitializeComponent();
							 | 
						|||
| 
								 | 
							
								            //client = new WmsOutPickRequestClient(WcfHelp.getBasicBinding(), WcfHelp.getEndpoint("WmsOutPickRequestService"));
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								  
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        public static  string  custor_name="";
							 | 
						|||
| 
								 | 
							
								        public static string order_id = "";
							 | 
						|||
| 
								 | 
							
								        private void NoOutCheck_Load(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								          
							 | 
						|||
| 
								 | 
							
								            label4.Text = custor_name;
							 | 
						|||
| 
								 | 
							
								            label2.Text = order_id;
							 | 
						|||
| 
								 | 
							
								           // InitDataGridColumnHeader(dg1);
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrEmpty(order_id))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                tb1.SelectedIndex =1;
							 | 
						|||
| 
								 | 
							
								                GetNoOutData(label2.Text.Trim().ToString());
							 | 
						|||
| 
								 | 
							
								            }else{
							 | 
						|||
| 
								 | 
							
								                bindBg1();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        public   void GetNoOutData(string order)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if(order=="")
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                DataTable dt = client.getPickOrderDetails(order);
							 | 
						|||
| 
								 | 
							
								                Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								                dg2.DataSource = dt;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                if (dt.Rows.Count > 0)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    //  label5.Text = dt.Rows[0]["颜色"].ToString() + ":" + dt.Rows.Count.ToString();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    label5.Text = "0";
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                bindBg2(dt);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception er)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								                MessageBox.Show("发生错误:" + er.Message);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								          
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            //tb1.SelectedIndex = 1;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        private void dg1_DoubleClick(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (dg1.DataSource==null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if(dg1.CurrentRowIndex<0)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            //string sale_order = dg1[dg1.CurrentRowIndex, 0].ToString();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            //string custor_name = dg1[dg1.CurrentRowIndex, 1].ToString();
							 | 
						|||
| 
								 | 
							
								            label2.Text = dg1[dg1.CurrentRowIndex, 3].ToString();
							 | 
						|||
| 
								 | 
							
								            label4.Text = dg1[dg1.CurrentRowIndex, 0].ToString();
							 | 
						|||
| 
								 | 
							
								            Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
							 | 
						|||
| 
								 | 
							
								            DataTable dt = null;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                dt = client.getPickOrderDetails(label2.Text);
							 | 
						|||
| 
								 | 
							
								                Cursor.Current = System.Windows.Forms.Cursors.Default; 
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception er)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								                MessageBox.Show("发生错误:" + er.Message);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								           
							 | 
						|||
| 
								 | 
							
								            
							 | 
						|||
| 
								 | 
							
								            if (dt.Rows.Count > 0)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								               // label5.Text = dt.Rows[0]["颜色"].ToString() + ":" + dt.Rows.Count.ToString();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                label5.Text = "0";
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            bindBg2(dt);
							 | 
						|||
| 
								 | 
							
								             
							 | 
						|||
| 
								 | 
							
								            tb1.SelectedIndex = 1;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								           
							 | 
						|||
| 
								 | 
							
								                  
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        private void tb1_SelectedIndexChanged(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								           
							 | 
						|||
| 
								 | 
							
								            if (tb1.SelectedIndex == 0)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                bindBg1();
							 | 
						|||
| 
								 | 
							
								               /*
							 | 
						|||
| 
								 | 
							
								                 dg1.TableStyles[0].GridColumnStyles["出库单"].Width = 80;
							 | 
						|||
| 
								 | 
							
								                 dg1.TableStyles[0].GridColumnStyles["客户"].Width = 140;
							 | 
						|||
| 
								 | 
							
								                 dg1.TableStyles[0].GridColumnStyles["状态"].Width = 60;
							 | 
						|||
| 
								 | 
							
								                */
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        private void bindBg1()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
							 | 
						|||
| 
								 | 
							
								            DataTable dt;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								              dt = client.getBatchPickOrders4Valid();
							 | 
						|||
| 
								 | 
							
								                dg1.DataSource = dt;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception er)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Cursor.Current = System.Windows.Forms.Cursors.Default; 
							 | 
						|||
| 
								 | 
							
								                MessageBox.Show("发生错误:" + er.Message);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								           
							 | 
						|||
| 
								 | 
							
								            Cursor.Current = System.Windows.Forms.Cursors.Default; 
							 | 
						|||
| 
								 | 
							
								          
							 | 
						|||
| 
								 | 
							
								            dg1.TableStyles.Clear();
							 | 
						|||
| 
								 | 
							
								            DataGridTableStyle ts = new DataGridTableStyle();
							 | 
						|||
| 
								 | 
							
								            ts.MappingName = dt.TableName;
							 | 
						|||
| 
								 | 
							
								            dg1.TableStyles.Add(ts);
							 | 
						|||
| 
								 | 
							
								            ts.GridColumnStyles[0].Width = 120;
							 | 
						|||
| 
								 | 
							
								            ts.GridColumnStyles[1].Width = 60;
							 | 
						|||
| 
								 | 
							
								            ts.GridColumnStyles[2].Width = 60;
							 | 
						|||
| 
								 | 
							
								            ts.GridColumnStyles[3].Width = 90;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        private void bindBg2(DataTable dt) 
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            dg2.DataSource = dt;
							 | 
						|||
| 
								 | 
							
								            dg2.TableStyles.Clear();
							 | 
						|||
| 
								 | 
							
								            DataGridTableStyle dgts = new DataGridTableStyle();
							 | 
						|||
| 
								 | 
							
								            dgts.MappingName = dt.TableName; // 必须用 ds.TableName, dt.TableSpace 不行!!!!
							 | 
						|||
| 
								 | 
							
								            dg2.TableStyles.Add(dgts);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            dg2.TableStyles[0].GridColumnStyles["商品"].Width = 80;
							 | 
						|||
| 
								 | 
							
								            dg2.TableStyles[0].GridColumnStyles["数量"].Width = 60;
							 | 
						|||
| 
								 | 
							
								            dg2.TableStyles[0].GridColumnStyles["货位"].Width = 70;
							 | 
						|||
| 
								 | 
							
								            dg2.TableStyles[0].GridColumnStyles["批号"].Width = 80;
							 | 
						|||
| 
								 | 
							
								            dg2.TableStyles[0].GridColumnStyles["厂家"].Width = 150;
							 | 
						|||
| 
								 | 
							
								           // dg2.TableStyles[0].GridColumnStyles["pickOrderNo"].Width = 0;
							 | 
						|||
| 
								 | 
							
								           // dg2.TableStyles[0].GridColumnStyles["state"].Width = 0;
							 | 
						|||
| 
								 | 
							
								         //   dg2.TableStyles[0].GridColumnStyles["状态"].Width = 70;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								 /*
							 | 
						|||
| 
								 | 
							
								            dgts.GridColumnStyles[0].Width = 80;
							 | 
						|||
| 
								 | 
							
								            dgts.GridColumnStyles[1].Width = 35;
							 | 
						|||
| 
								 | 
							
								            dgts.GridColumnStyles[2].Width = 20;
							 | 
						|||
| 
								 | 
							
								            dgts.GridColumnStyles[3].Width = 0; //状态
							 | 
						|||
| 
								 | 
							
								            dgts.GridColumnStyles[4].Width = 65;
							 | 
						|||
| 
								 | 
							
								            dgts.GridColumnStyles[5].Width = 60;
							 | 
						|||
| 
								 | 
							
								            dgts.GridColumnStyles[6].Width = 140;
							 | 
						|||
| 
								 | 
							
								            dgts.GridColumnStyles[7].Width = 0;
							 | 
						|||
| 
								 | 
							
								            dgts.GridColumnStyles[8].Width = 0;
							 | 
						|||
| 
								 | 
							
								            dgts.GridColumnStyles[9].Width = 0;
							 | 
						|||
| 
								 | 
							
								            dgts.GridColumnStyles[10].Width = 0;
							 | 
						|||
| 
								 | 
							
								            dgts.GridColumnStyles[11].Width = 0;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								           
							 | 
						|||
| 
								 | 
							
								            
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            
							 | 
						|||
| 
								 | 
							
								   
							 | 
						|||
| 
								 | 
							
								            DataGridTableStyle dts = new DataGridTableStyle();
							 | 
						|||
| 
								 | 
							
								            //注意:必须加上这一句,否则自定义列格式无法使用
							 | 
						|||
| 
								 | 
							
								            dts.MappingName = "Table";
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles.Clear();
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles.Add(dts);
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles[0].GridColumnStyles.Clear();
							 | 
						|||
| 
								 | 
							
								            //========================设置表头栏位===========================
							 | 
						|||
| 
								 | 
							
								           // DataGridTableStyle dtsLog = new DataGridTableStyle();
							 | 
						|||
| 
								 | 
							
								  
							 | 
						|||
| 
								 | 
							
								            DataGridTextBoxColumn col1 = new DataGridTextBoxColumn();
							 | 
						|||
| 
								 | 
							
								            col1.Width = 140;
							 | 
						|||
| 
								 | 
							
								            col1.HeaderText = "品名";
							 | 
						|||
| 
								 | 
							
								            col1.MappingName = "goodsname";
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles[0].GridColumnStyles.Add(col1);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            DataGridTextBoxColumn col2 = new DataGridTextBoxColumn();
							 | 
						|||
| 
								 | 
							
								            col2.Width = 60;
							 | 
						|||
| 
								 | 
							
								            col2.HeaderText = "出库数量";
							 | 
						|||
| 
								 | 
							
								            col2.MappingName = "count";
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles[0].GridColumnStyles.Add(col2);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            DataGridTextBoxColumn col3 = new DataGridTextBoxColumn();
							 | 
						|||
| 
								 | 
							
								            col3.Width = 70;
							 | 
						|||
| 
								 | 
							
								            col3.HeaderText = "货位";
							 | 
						|||
| 
								 | 
							
								            col3.MappingName = "location";
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles[0].GridColumnStyles.Add(col3);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            DataGridTextBoxColumn col4 = new DataGridTextBoxColumn();
							 | 
						|||
| 
								 | 
							
								            col4.Width = 80;
							 | 
						|||
| 
								 | 
							
								            col4.HeaderText = "批号";
							 | 
						|||
| 
								 | 
							
								            col4.MappingName = "batch";
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles[0].GridColumnStyles.Add(col4);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            DataGridTextBoxColumn col5 = new DataGridTextBoxColumn();
							 | 
						|||
| 
								 | 
							
								            col5.Width = 150;
							 | 
						|||
| 
								 | 
							
								            col5.HeaderText = "厂家";
							 | 
						|||
| 
								 | 
							
								            col5.MappingName = "manufacturer";
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles[0].GridColumnStyles.Add(col5);
							 | 
						|||
| 
								 | 
							
								             * */
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |