146 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			146 lines
		
	
	
		
			4.6 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; | |||
|  |         string flowNo = ""; | |||
|  |        | |||
|  |         public RepStockOut() | |||
|  |         { | |||
|  |             setTitle(); | |||
|  |             InitializeComponent(); | |||
|  |       //      client = new WmsOutPickRequestClient(WcfHelp.getBasicBinding(), WcfHelp.getEndpoint("WmsOutPickRequestService")); | |||
|  |             getRepOutList(); | |||
|  |             focusOn(txtFlow);  | |||
|  |            | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  |         private void getRepOutList() | |||
|  |         { | |||
|  |             Cursor.Current = Cursors.WaitCursor; | |||
|  | 
 | |||
|  |             try | |||
|  |             { | |||
|  |                 int takeby = chkMeonly.Checked ? LoginInfo.UserId : 0; | |||
|  | 
 | |||
|  |                 dt = client.repTodayDetails4Pick(takeby); | |||
|  |                   | |||
|  |                | |||
|  |             } | |||
|  |             catch (Exception er) | |||
|  |             { | |||
|  |                 Cursor.Current = Cursors.Default; | |||
|  | 
 | |||
|  |                 MessageBox.Show("出错了:" + er.Message); | |||
|  |             } | |||
|  |             focusOn(txtLoc);   | |||
|  |              | |||
|  |             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 = 90; | |||
|  |             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; | |||
|  |           //  dg1.TableStyles[0].GridColumnStyles["takeBy"].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(txtLoc.Text.Trim()=="") | |||
|  |                 { | |||
|  |                     return; | |||
|  |                 } | |||
|  |                 DataView dv = dt.DefaultView; | |||
|  | 
 | |||
|  |                 dv.RowFilter = string.Format("货位='{0}'", txtLoc.Text.Trim()); | |||
|  | 
 | |||
|  |                 if (dv.Count > 0) | |||
|  |                 { | |||
|  |                     flowNo = txtFlow.Text.Trim(); | |||
|  |                     if (String.IsNullOrEmpty(flowNo)) | |||
|  |                     { | |||
|  |                         MessageBox.Show("请输入下架容器码"); | |||
|  |                         focusOn(txtFlow);  | |||
|  |                         return; | |||
|  |                     } | |||
|  |                     string orderNo = dv[0]["pickOrderNo"].ToString(); | |||
|  |                     int id = Convert.ToInt32(dv[0]["id"].ToString()); | |||
|  |                     decimal pickCount = Convert.ToDecimal(dv[0]["数量"].ToString());   | |||
|  |                     Cursor.Current = Cursors.WaitCursor; | |||
|  |                     try | |||
|  |                     { | |||
|  |                         client.finishPickItem(flowNo, "", orderNo, id, pickCount, LoginInfo.UserId, LoginInfo.Token); | |||
|  |                     } | |||
|  |                     catch (Exception er) | |||
|  |                     { | |||
|  |                         Cursor.Current = Cursors.Default; | |||
|  | 
 | |||
|  |                         showErrorMsg(er); | |||
|  |                     } | |||
|  |                     getRepOutList(); | |||
|  | 
 | |||
|  | 
 | |||
|  |                     Cursor.Current = Cursors.Default; | |||
|  | 
 | |||
|  |                     dv.RowFilter = ""; | |||
|  |                     txtLoc.Text = ""; | |||
|  | 
 | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     txtLoc.SelectAll(); | |||
|  |                 } | |||
|  |               | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         private void button1_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             getRepOutList(); | |||
|  |         } | |||
|  | 
 | |||
|  |         | |||
|  | 
 | |||
|  |         private void txtFlow_KeyUp(object sender, KeyEventArgs e) | |||
|  |         { | |||
|  |             if (e.KeyCode == Keys.Enter) | |||
|  |             { | |||
|  |                 focusOn(txtLoc);   | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |           | |||
|  |     } | |||
|  | } |