338 lines
		
	
	
		
			9.3 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			338 lines
		
	
	
		
			9.3 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using System.ComponentModel;
							 | 
						|||
| 
								 | 
							
								using System.Drawing;
							 | 
						|||
| 
								 | 
							
								using System.Text;
							 | 
						|||
| 
								 | 
							
								using System.Windows.Forms;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								using System.Collections.Specialized;
							 | 
						|||
| 
								 | 
							
								using System.Data;
							 | 
						|||
| 
								 | 
							
								 
							 | 
						|||
| 
								 | 
							
								 
							 | 
						|||
| 
								 | 
							
								using System.Collections;
							 | 
						|||
| 
								 | 
							
								namespace DeiNiu.Wms.CE
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class StockPandianPick : basicForm
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        #region 界面初始化
							 | 
						|||
| 
								 | 
							
								        //public int page = 0;
							 | 
						|||
| 
								 | 
							
								        string orderNo = "";
							 | 
						|||
| 
								 | 
							
								        int skuId = 0;
							 | 
						|||
| 
								 | 
							
								        DataTable dt = new DataTable();
							 | 
						|||
| 
								 | 
							
								        public StockPandianPick()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            setTitle();
							 | 
						|||
| 
								 | 
							
								            InitializeComponent();
							 | 
						|||
| 
								 | 
							
								            lacationid_txt.Focus();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        private void StockPandianPick_Load(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            DataTable dta = null;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                dta = client.getPandianOrders(0, 1);//.getStockLocation(locId);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception er)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								                MessageBox.Show("发生错误:" + er.Message);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            skuId_txt.ReadOnly = dta.Rows.Count == 0;
							 | 
						|||
| 
								 | 
							
								            this.lacationid_txt.ReadOnly = dta.Rows.Count == 0;
							 | 
						|||
| 
								 | 
							
								            this.count_txt.ReadOnly = dta.Rows.Count == 0; 
							 | 
						|||
| 
								 | 
							
								            if (dta.Rows.Count > 0)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                this.orderNo_lab.Text = dta.Rows[0]["orderNo"].ToString();//pandian orderno
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                this.start_date_lab.Text = dta.Rows[0]["startTime"].ToString();//start date 
							 | 
						|||
| 
								 | 
							
								               
							 | 
						|||
| 
								 | 
							
								                orderNo = this.orderNo_lab.Text;
							 | 
						|||
| 
								 | 
							
								              
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                clear(); 
							 | 
						|||
| 
								 | 
							
								                MessageBox.Show("没有盘点任务");
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 扫描SKUID 
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        /// 
							 | 
						|||
| 
								 | 
							
								        private void skuId_txt_KeyUp(object sender, KeyEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (e.KeyCode != Keys.Enter)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            if (skuId_txt.Text.Length < 2)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                int skuId = Convert.ToInt16(skuId_txt.Text);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                MessageBox.Show("请输入正确的条码");
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            count_txt.Enabled = true;
							 | 
						|||
| 
								 | 
							
								            lacationid_txt.Enabled = skuId_txt.Enabled = !count_txt.Enabled;
							 | 
						|||
| 
								 | 
							
								             
							 | 
						|||
| 
								 | 
							
								            count_txt.Focus();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 绑定数据到界面
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="index0"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="GetData"></param>
							 | 
						|||
| 
								 | 
							
								        private void SetValue(int index0, DataTable dt)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.skuId_txt.Text = dt.Rows[0]["skuId"].ToString();//skuId
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            this.count_txt.Text = dt.Rows[0]["count"].ToString();//count
							 | 
						|||
| 
								 | 
							
								            skuId_txt.SelectAll();
							 | 
						|||
| 
								 | 
							
								            skuId_txt.Focus();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 扫描货位码
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        private void lacationid_txt_KeyUp(object sender, KeyEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            if (e.KeyCode == Keys.Enter)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                string locId = lacationid_txt.Text;
							 | 
						|||
| 
								 | 
							
								                //lacationid_txt.Text = "";
							 | 
						|||
| 
								 | 
							
								             
							 | 
						|||
| 
								 | 
							
								                if (locId.Length < 7)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    MessageBox.Show("请扫货位条码");
							 | 
						|||
| 
								 | 
							
								                    return;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                if (cb1.Checked)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    #region 根据货位显示已采集信息
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                  
							 | 
						|||
| 
								 | 
							
								                    DataTable dta = null;
							 | 
						|||
| 
								 | 
							
								                  
							 | 
						|||
| 
								 | 
							
								                    Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
							 | 
						|||
| 
								 | 
							
								                    try
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        dta = client.getPandianItem(orderNo,locId);//.getStockLocation(locId);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    catch (Exception er)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								                        MessageBox.Show("发生错误:" + er.Message);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        return;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    Cursor.Current = System.Windows.Forms.Cursors.Default;  
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                   if (dta.Rows.Count > 0)
							 | 
						|||
| 
								 | 
							
								                   { 
							 | 
						|||
| 
								 | 
							
								                       SetValue(0, dta); 
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                   }
							 | 
						|||
| 
								 | 
							
								                   else
							 | 
						|||
| 
								 | 
							
								                   { 
							 | 
						|||
| 
								 | 
							
								                       clear();
							 | 
						|||
| 
								 | 
							
								                       MessageBox.Show("货位为空!!!");
							 | 
						|||
| 
								 | 
							
								                   }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    
							 | 
						|||
| 
								 | 
							
								                    #endregion
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                   
							 | 
						|||
| 
								 | 
							
								                    #region 
							 | 
						|||
| 
								 | 
							
								                    /*
							 | 
						|||
| 
								 | 
							
								                    label17.Visible = oldcount_lab.Visible = true;
							 | 
						|||
| 
								 | 
							
								                    decimal count =0m;
							 | 
						|||
| 
								 | 
							
								                    try
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        count = Convert.ToDecimal(count_txt.Text);
							 | 
						|||
| 
								 | 
							
								                        if (count  <= 0)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            MessageBox.Show("入库数量必须大于0");
							 | 
						|||
| 
								 | 
							
								                            count_txt.SelectAll();
							 | 
						|||
| 
								 | 
							
								                            count_txt.Focus();
							 | 
						|||
| 
								 | 
							
								                            return;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    catch
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        MessageBox.Show("入库数量必须大于0的数字");
							 | 
						|||
| 
								 | 
							
								                        count_txt.SelectAll();
							 | 
						|||
| 
								 | 
							
								                        count_txt.Focus();
							 | 
						|||
| 
								 | 
							
								                        return;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    lacationid_lab.Text = locId;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    enumRepResult result ; 
							 | 
						|||
| 
								 | 
							
								                    Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
							 | 
						|||
| 
								 | 
							
								                    try
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        result = (enumRepResult)client.upDownStockLocation(locId, gooodsid, skuId, batch_lab.Text, count, (int)enumStockRecordType.初始盘点, LoginInfo.UserId, LoginInfo.Token, -1);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    catch (Exception er)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								                        MessageBox.Show("发生错误:" + er.Message);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        return;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    Cursor.Current = System.Windows.Forms.Cursors.Default;  
							 | 
						|||
| 
								 | 
							
								 
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    MessageBox.Show(result.ToString());
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    if (result == enumRepResult.成功)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        if (ye < 2)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                            clear();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        lacationid_lab.Text = "";
							 | 
						|||
| 
								 | 
							
								                        skuId_txt.Focus();
							 | 
						|||
| 
								 | 
							
								                       
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    lacationid_lab.Text = lacationid_txt.Text = "";
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								  */
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    #endregion 
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                skuId_txt.Enabled = true;
							 | 
						|||
| 
								 | 
							
								                 lacationid_txt.Enabled = count_txt.Enabled = !skuId_txt.Enabled;
							 | 
						|||
| 
								 | 
							
								                skuId_txt.Focus();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        private void cb1_CheckStateChanged(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {/*
							 | 
						|||
| 
								 | 
							
								            if (cb1.Checked)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                skuId_txt.ReadOnly = true;
							 | 
						|||
| 
								 | 
							
								                clear();
							 | 
						|||
| 
								 | 
							
								                lacationid_txt.Focus();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                skuId_txt.ReadOnly = false;
							 | 
						|||
| 
								 | 
							
								                clear();
							 | 
						|||
| 
								 | 
							
								               
							 | 
						|||
| 
								 | 
							
								                skuId_txt.Focus();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								          */
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        private void clear()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								           skuId_txt.Text = count_txt.Text = this.lacationid_txt.Text  = "";
							 | 
						|||
| 
								 | 
							
								           lacationid_txt.Enabled = true;
							 | 
						|||
| 
								 | 
							
								           skuId_txt.Enabled = count_txt.Enabled =  lacationid_txt.Enabled;
							 | 
						|||
| 
								 | 
							
								           lacationid_txt.Focus();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        private void count_txt_KeyUp(object sender, KeyEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            //to record the record to db
							 | 
						|||
| 
								 | 
							
								            if (e.KeyCode != Keys.Enter)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            decimal count = 0m;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                count = Convert.ToDecimal(count_txt.Text.ToString());
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                MessageBox.Show("请输入数量!");
							 | 
						|||
| 
								 | 
							
								                count_txt.Focus();
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                string locId = lacationid_txt.Text;
							 | 
						|||
| 
								 | 
							
								                int skuId = Convert.ToInt16(skuId_txt.Text);
							 | 
						|||
| 
								 | 
							
								                Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								               bool result =  client.newPandianItem(orderNo,locId,skuId, count , LoginInfo.UserId, LoginInfo.Token);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                if (!result )
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    MessageBox.Show("盘点失败"  ); 
							 | 
						|||
| 
								 | 
							
								                    return;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    
							 | 
						|||
| 
								 | 
							
								                    clear();
							 | 
						|||
| 
								 | 
							
								                    return;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception er)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                MessageBox.Show("盘点失败!" + er.Message);
							 | 
						|||
| 
								 | 
							
								                Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            clear();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								       
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								      
							 | 
						|||
| 
								 | 
							
								       
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |