175 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			175 lines
		
	
	
		
			5.9 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 StockOut : basicForm 
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								       // WmsOutPickRequestClient client { get; set; }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        string id = string.Empty;
							 | 
						|||
| 
								 | 
							
								        string waveNo = string.Empty;
							 | 
						|||
| 
								 | 
							
								        int state = -100;
							 | 
						|||
| 
								 | 
							
								        string location = string.Empty;
							 | 
						|||
| 
								 | 
							
								        public StockOut()  
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            InitializeComponent();
							 | 
						|||
| 
								 | 
							
								            setTitle();
							 | 
						|||
| 
								 | 
							
								           // client = new WmsOutPickRequestClient(WcfHelp.getBasicBinding(), WcfHelp.getEndpoint("WmsOutPickRequestService"));
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        //先扫出库码,再扫货位
							 | 
						|||
| 
								 | 
							
								        private void goodscode_txt_KeyUp(object sender, KeyEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (e.KeyCode == Keys.Enter)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (state == 1) //已出库的自动清空数据,继续扫下一个出库码
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    clear();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                string barCode = barcode_txt.Text;
							 | 
						|||
| 
								 | 
							
								                barcode_txt.Text = "";
							 | 
						|||
| 
								 | 
							
								                if (string.IsNullOrEmpty(barCode))
							 | 
						|||
| 
								 | 
							
								                    return;
							 | 
						|||
| 
								 | 
							
								                //判断货位号是否不为空
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(locationid_lab.Text))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    //扫描货位时,比较是否相同
							 | 
						|||
| 
								 | 
							
								                    if (location.Equals(barCode + "x" ))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        try
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            if (state == 1 || client.finishPickItem(waveNo,order_id_lab.Text, Convert.ToInt32(id), LoginInfo.UserId, LoginInfo.Token))
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                //MessageBox.Show("!");
							 | 
						|||
| 
								 | 
							
								                                clear();
							 | 
						|||
| 
								 | 
							
								                                Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								                                return;
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								                            else
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								                                MessageBox.Show("出库失败!");
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        catch(Exception er)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            MessageBox.Show("出库失败!" + er.Message);
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                       
							 | 
						|||
| 
								 | 
							
								                        
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    else
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        MessageBox.Show("货位不符合");
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else//为空,说明是扫描的出库码
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    //条件扫描的条码值 获取货位、商品信息
							 | 
						|||
| 
								 | 
							
								                    GetPickData(barCode);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                barcode_txt.Focus();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        private void GetPickData(string portId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Convert.ToInt32(portId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                MessageBox.Show("输入错误");
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
							 | 
						|||
| 
								 | 
							
								                DataTable dt = client.getPickDetail(Convert.ToInt32(portId));
							 | 
						|||
| 
								 | 
							
								                Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                if (dt.Rows.Count > 0)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    name_lab.Text = dt.Rows[0]["goodsName"].ToString();
							 | 
						|||
| 
								 | 
							
								                    spec_lab.Text = dt.Rows[0]["spec"].ToString();
							 | 
						|||
| 
								 | 
							
								                    unit_lab.Text = dt.Rows[0]["unit"].ToString();
							 | 
						|||
| 
								 | 
							
								                    PCompany_lab.Text = dt.Rows[0]["manufacturer"].ToString();
							 | 
						|||
| 
								 | 
							
								                    custor_name_lab.Text = dt.Rows[0]["customerName"].ToString();
							 | 
						|||
| 
								 | 
							
								                    Stocknum_lab.Text = dt.Rows[0]["count"].ToString();
							 | 
						|||
| 
								 | 
							
								                    locationid_lab.Text = dt.Rows[0]["locationId"].ToString();
							 | 
						|||
| 
								 | 
							
								                    location = locationid_lab.Text + "x";
							 | 
						|||
| 
								 | 
							
								                    batch_lab.Text = dt.Rows[0]["batch"].ToString();
							 | 
						|||
| 
								 | 
							
								                    product_date_lab.Text = dt.Rows[0]["productdate"].ToString();
							 | 
						|||
| 
								 | 
							
								                    save_date_lab.Text = dt.Rows[0]["validdate"].ToString();
							 | 
						|||
| 
								 | 
							
								                    order_id_lab.Text = dt.Rows[0]["pickOrderNo"].ToString();
							 | 
						|||
| 
								 | 
							
								                    id = dt.Rows[0]["id"].ToString();
							 | 
						|||
| 
								 | 
							
								                    state = Convert.ToInt16(dt.Rows[0]["state"].ToString());
							 | 
						|||
| 
								 | 
							
								                    label12.Text = state == 1 ? "已出库" : state == 0 ? "待出库" : "已复核";
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    bigcount_lab.Text = dt.Rows[0]["bigcount"].ToString();
							 | 
						|||
| 
								 | 
							
								                    double intnum = Convert.ToDouble(Convert.ToDouble(dt.Rows[0]["count"].ToString()) / Convert.ToDouble(dt.Rows[0]["bigcount"].ToString()));
							 | 
						|||
| 
								 | 
							
								                    int_lab.Text = intnum.ToString();
							 | 
						|||
| 
								 | 
							
								                    waveNo = dt.Rows[0]["waveOrder"].ToString();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    clear();
							 | 
						|||
| 
								 | 
							
								                    //code = "";
							 | 
						|||
| 
								 | 
							
								                    //row_lab.Text = "";
							 | 
						|||
| 
								 | 
							
								                    barcode_txt.Focus();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            catch (Exception er)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                MessageBox.Show("获取数据失败!" + er.Message);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 清除界面数据
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        private void clear()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            name_lab.Text =
							 | 
						|||
| 
								 | 
							
								            spec_lab.Text =
							 | 
						|||
| 
								 | 
							
								            unit_lab.Text =
							 | 
						|||
| 
								 | 
							
								            PCompany_lab.Text =
							 | 
						|||
| 
								 | 
							
								            custor_name_lab.Text =
							 | 
						|||
| 
								 | 
							
								            Stocknum_lab.Text =
							 | 
						|||
| 
								 | 
							
								            locationid_lab.Text =
							 | 
						|||
| 
								 | 
							
								            batch_lab.Text =
							 | 
						|||
| 
								 | 
							
								            product_date_lab.Text =
							 | 
						|||
| 
								 | 
							
								            save_date_lab.Text =
							 | 
						|||
| 
								 | 
							
								            int_lab.Text =
							 | 
						|||
| 
								 | 
							
								            order_id_lab.Text =
							 | 
						|||
| 
								 | 
							
								            bigcount_lab.Text =
							 | 
						|||
| 
								 | 
							
								            id = "";
							 | 
						|||
| 
								 | 
							
								            state = -100;
							 | 
						|||
| 
								 | 
							
								            label12.Text = "";
							 | 
						|||
| 
								 | 
							
								            location = "";
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								      
							 | 
						|||
| 
								 | 
							
								        
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |