119 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			119 lines
		
	
	
		
			3.7 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 RepStockOut : basicForm  | |||
|  |     { | |||
|  |      //   WmsOutPickRequestClient client { get; set; } | |||
|  |         DataTable dt = null; | |||
|  |         public RepStockOut() | |||
|  |         { | |||
|  |             setTitle(); | |||
|  |             InitializeComponent(); | |||
|  |       //      client = new WmsOutPickRequestClient(WcfHelp.getBasicBinding(), WcfHelp.getEndpoint("WmsOutPickRequestService")); | |||
|  |             getRepOutList(); | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  |         private void getRepOutList() | |||
|  |         { | |||
|  |             Cursor.Current = Cursors.WaitCursor; | |||
|  | 
 | |||
|  |             try | |||
|  |             { | |||
|  |                 dt = client.repTodayDetails4Pick(); | |||
|  |             } | |||
|  |             catch (Exception er) | |||
|  |             { | |||
|  |                 Cursor.Current = Cursors.Default; | |||
|  | 
 | |||
|  |                 MessageBox.Show("出错了:" + er.Message); | |||
|  |             } | |||
|  | 
 | |||
|  |             Cursor.Current = Cursors.Default; | |||
|  |             dg1.DataSource = dt; | |||
|  |             dg1.TableStyles.Clear(); | |||
|  |             DataGridTableStyle dgts = new DataGridTableStyle(); | |||
|  |             dgts.MappingName = dt.TableName; // 必须用 ds.TableName, dt.TableSpace 不行!!!! | |||
|  |             dg1.TableStyles.Add(dgts); | |||
|  | 
 | |||
|  |             dg1.TableStyles[0].GridColumnStyles["商品"].Width = 80; | |||
|  |             dg1.TableStyles[0].GridColumnStyles["数量"].Width = 30; | |||
|  |             dg1.TableStyles[0].GridColumnStyles["件"].Width = 20; | |||
|  |             dg1.TableStyles[0].GridColumnStyles["货位"].Width = 70; | |||
|  |             dg1.TableStyles[0].GridColumnStyles["批号"].Width = 80; | |||
|  |             dg1.TableStyles[0].GridColumnStyles["厂家"].Width = 150; | |||
|  |             dg1.TableStyles[0].GridColumnStyles["pickorderNO"].Width = 0; | |||
|  |             dg1.TableStyles[0].GridColumnStyles["id"].Width = 0; | |||
|  |             // dg2.TableStyles[0].GridColumnStyles["pickOrderNo"].Width = 0; | |||
|  |             // dg2.TableStyles[0].GridColumnStyles["state"].Width = 0; | |||
|  |             //dg2.TableStyles[0].GridColumnStyles["状态"].Width = 70; | |||
|  | 
 | |||
|  | 
 | |||
|  |             //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; | |||
|  |         } | |||
|  | 
 | |||
|  |         private void textBox1_KeyPress(object sender, KeyPressEventArgs e) | |||
|  |         { | |||
|  |             if(e.KeyChar==13) | |||
|  |             {  | |||
|  |                 if(textBox1.Text.Trim()=="") | |||
|  |                 { | |||
|  |                     return; | |||
|  |                 } | |||
|  |                 DataView dv = dt.DefaultView; | |||
|  | 
 | |||
|  |                 dv.RowFilter = string.Format("货位='{0}'", textBox1.Text.Trim()); | |||
|  | 
 | |||
|  |                 if (dv.Count > 0) | |||
|  |                 { | |||
|  | 
 | |||
|  |                     string orderNo = dv[0]["pickOrderNo"].ToString(); | |||
|  |                     int id = Convert.ToInt32(dv[0]["id"].ToString()); | |||
|  |                     Cursor.Current = Cursors.WaitCursor; | |||
|  |                     try | |||
|  |                     { | |||
|  |                         client.finishPickItem(null,orderNo, id, LoginInfo.UserId, LoginInfo.Token); | |||
|  |                     } | |||
|  |                     catch (Exception er) | |||
|  |                     { | |||
|  |                         Cursor.Current = Cursors.Default; | |||
|  | 
 | |||
|  |                         MessageBox.Show("出错了:" + er.Message); | |||
|  |                     } | |||
|  |                     getRepOutList(); | |||
|  | 
 | |||
|  | 
 | |||
|  |                     Cursor.Current = Cursors.Default; | |||
|  | 
 | |||
|  |                     dv.RowFilter = ""; | |||
|  |                     textBox1.Text = ""; | |||
|  | 
 | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     textBox1.SelectAll(); | |||
|  |                 } | |||
|  |               | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         private void button1_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             getRepOutList(); | |||
|  |         } | |||
|  | 
 | |||
|  |           | |||
|  |     } | |||
|  | } |