644 lines
		
	
	
		
			18 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			644 lines
		
	
	
		
			18 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using System.ComponentModel;
							 | 
						|||
| 
								 | 
							
								using System.Data;
							 | 
						|||
| 
								 | 
							
								using System.Drawing;
							 | 
						|||
| 
								 | 
							
								using System.Text;
							 | 
						|||
| 
								 | 
							
								using System.Windows.Forms;
							 | 
						|||
| 
								 | 
							
								using System.Runtime.InteropServices;
							 | 
						|||
| 
								 | 
							
								using System.Collections;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace DeiNiu.Wms.CE
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class StockMaintain : basicForm
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        public StockMaintain()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            InitializeComponent();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								      
							 | 
						|||
| 
								 | 
							
								        DataTable dt = null;
							 | 
						|||
| 
								 | 
							
								        string  djbh = "";
							 | 
						|||
| 
								 | 
							
								        int number = 0;
							 | 
						|||
| 
								 | 
							
								        string location = "";
							 | 
						|||
| 
								 | 
							
								        string loca = "";
							 | 
						|||
| 
								 | 
							
								        ArrayList ar = new ArrayList();
							 | 
						|||
| 
								 | 
							
								        int stkId = 0;
							 | 
						|||
| 
								 | 
							
								        decimal mcount = 0m;
							 | 
						|||
| 
								 | 
							
								        string goodsId = "";
							 | 
						|||
| 
								 | 
							
								        string batch = "";
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        private void StockMaintain_Load(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        { 
							 | 
						|||
| 
								 | 
							
								            setTitle();
							 | 
						|||
| 
								 | 
							
								            showdata("");
							 | 
						|||
| 
								 | 
							
								          //  dataGrid1.DataSource = client.getIssueData("");
							 | 
						|||
| 
								 | 
							
								            DataTable dtx ;
							 | 
						|||
| 
								 | 
							
								            Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                dtx =  client.getIssueData("");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception er)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								                MessageBox.Show("发生错误:" + er.Message);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            bindDg(dataGrid1,dtx);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 展示待养护信息
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        private void showdata(string locationId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            dg.DataSource = null;
							 | 
						|||
| 
								 | 
							
								            dt = new DataTable();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            DataSet ds;
							 | 
						|||
| 
								 | 
							
								            int cnt = 0;
							 | 
						|||
| 
								 | 
							
								            Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ds = client.getData4Maintain(locationId);
							 | 
						|||
| 
								 | 
							
								                cnt = Convert.ToInt16(ds.Tables[1].Rows[0][0].ToString());
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception er)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								                MessageBox.Show("发生错误:" + er.Message);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            dt = ds.Tables[0];
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								         
							 | 
						|||
| 
								 | 
							
								            lbrecordcount.Text = string.Format("{0}/{1}条", dt.Rows.Count, cnt);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            if (dt.Rows.Count == 0)
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								          
							 | 
						|||
| 
								 | 
							
								            // dg.DataSource = dt;
							 | 
						|||
| 
								 | 
							
								           // dg1.DataSource = client.getIssueData("");
							 | 
						|||
| 
								 | 
							
								            bindDg(dg,dt);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            DataTable dtx; 
							 | 
						|||
| 
								 | 
							
								            Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                dtx =client.getIssueData("");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception er)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								                MessageBox.Show("发生错误:" + er.Message);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            bindDg(dg1, dtx);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            /*DataGridTableStyle ts = new DataGridTableStyle();
							 | 
						|||
| 
								 | 
							
								            ts.MappingName = dt.TableName;
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles.Add(ts);
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles[0].GridColumnStyles["货位"].Width = 65;
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles[0].GridColumnStyles["数量"].Width = 40;
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles[0].GridColumnStyles["商品"].Width = 100;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            for (int i = 0; i < dt.Columns.Count; i++)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (i >= 2) //如果某个条件满足就执行该列是否隐藏
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    dg.TableStyles[0].GridColumnStyles[i].Width = 0;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            */
							 | 
						|||
| 
								 | 
							
								           
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        void bindDg(DataGrid dg,DataTable dt)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            dg.DataSource = dt;
							 | 
						|||
| 
								 | 
							
								            DataGridTableStyle ts = new DataGridTableStyle();
							 | 
						|||
| 
								 | 
							
								            ts.MappingName = dt.TableName;
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles.Clear();
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles.Add(ts);
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles[0].GridColumnStyles["货位"].Width = 70;
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles[0].GridColumnStyles["数量"].Width = 40;
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles[0].GridColumnStyles["商品"].Width = 100;
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles[0].GridColumnStyles["厂家"].Width = 120;
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles[0].GridColumnStyles["养护周期"].Width = 80;
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles[0].GridColumnStyles["上次养护"].Width = 80;
							 | 
						|||
| 
								 | 
							
								            dg.TableStyles[0].GridColumnStyles["下次养护"].Width = 80;
							 | 
						|||
| 
								 | 
							
								            for (int i = 0; i < dt.Columns.Count; i++)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (i > 13) //如果某个条件满足就执行该列是否隐藏
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    dg.TableStyles[0].GridColumnStyles[i].Width = 0;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        private void dg_DoubleClick(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (dg.CurrentRowIndex > -1)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                lbname.Text = dg[dg.CurrentRowIndex, 1].ToString().Trim();
							 | 
						|||
| 
								 | 
							
								                lbspec.Text = dg[dg.CurrentRowIndex, 8].ToString().Trim();
							 | 
						|||
| 
								 | 
							
								                lbbatch.Text = dg[dg.CurrentRowIndex, 2].ToString().Trim();
							 | 
						|||
| 
								 | 
							
								                lbcount.Text = dg[dg.CurrentRowIndex, 3].ToString().Trim();
							 | 
						|||
| 
								 | 
							
								                lbunit.Text = dg[dg.CurrentRowIndex, 4].ToString().Trim();
							 | 
						|||
| 
								 | 
							
								                txtlocationId.Text = dg[dg.CurrentRowIndex, 0].ToString().Trim();
							 | 
						|||
| 
								 | 
							
								                lbyxq.Text = dg[dg.CurrentRowIndex, 6].ToString().Trim();
							 | 
						|||
| 
								 | 
							
								                lbshccj.Text = dg[dg.CurrentRowIndex, 7].ToString().Trim();
							 | 
						|||
| 
								 | 
							
								                location = dg[dg.CurrentRowIndex, 0].ToString();
							 | 
						|||
| 
								 | 
							
								                stkId = Convert.ToInt32(dt.Rows[dg.CurrentRowIndex]["id"].ToString());
							 | 
						|||
| 
								 | 
							
								                mcount = Convert.ToDecimal(lbcount.Text);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                //djbh = dg[dg.CurrentRowIndex, 10].ToString().Trim();
							 | 
						|||
| 
								 | 
							
								                //number = Convert.ToInt32(dg[dg.CurrentRowIndex, 11].ToString().Trim());
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 养护措施
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        private string get_yhcsh()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            string yhcsh = "";
							 | 
						|||
| 
								 | 
							
								            if (cb1.Checked)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (yhcsh == "")
							 | 
						|||
| 
								 | 
							
								                    yhcsh = cb1.Text.Trim();
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                    yhcsh += "," + cb1.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (cb2.Checked)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (yhcsh == "")
							 | 
						|||
| 
								 | 
							
								                    yhcsh = cb2.Text.Trim();
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                    yhcsh += "," + cb2.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (cb3.Checked)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (yhcsh == "")
							 | 
						|||
| 
								 | 
							
								                    yhcsh = cb3.Text.Trim();
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                    yhcsh += "," + cb3.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (cb4.Checked)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (yhcsh == "")
							 | 
						|||
| 
								 | 
							
								                    yhcsh = cb4.Text.Trim();
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                    yhcsh += "," + cb4.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (cb5.Checked)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (yhcsh == "")
							 | 
						|||
| 
								 | 
							
								                    yhcsh = cb5.Text.Trim();
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                    yhcsh += "," + cb5.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (cb6.Checked)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (yhcsh == "")
							 | 
						|||
| 
								 | 
							
								                    yhcsh = cb6.Text.Trim();
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                    yhcsh += "," + cb6.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            return yhcsh;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        private void clear()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            lbname.Text = "";
							 | 
						|||
| 
								 | 
							
								            lbspec.Text = "";
							 | 
						|||
| 
								 | 
							
								            lbbatch.Text = "";
							 | 
						|||
| 
								 | 
							
								            lbcount.Text = "";
							 | 
						|||
| 
								 | 
							
								            lbunit.Text = "";
							 | 
						|||
| 
								 | 
							
								            txtlocationId.Text = "";
							 | 
						|||
| 
								 | 
							
								            txtycsl.Text = "0";
							 | 
						|||
| 
								 | 
							
								            lbyxq.Text = "";
							 | 
						|||
| 
								 | 
							
								            lbshccj.Text = "";
							 | 
						|||
| 
								 | 
							
								            cb1.Checked = cb2.Checked = cb3.Checked = cb4.Checked = cb5.Checked = cb6.Checked =cb7.Checked=cb8.Checked= false;
							 | 
						|||
| 
								 | 
							
								            djbh = "";
							 | 
						|||
| 
								 | 
							
								            number = 0;
							 | 
						|||
| 
								 | 
							
								            location = "";
							 | 
						|||
| 
								 | 
							
								            lbGoodsType.Text = "";
							 | 
						|||
| 
								 | 
							
								            lbbigcount.Text = "";
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 确认养护
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        private void btnOK_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            newMaintain();
							 | 
						|||
| 
								 | 
							
								          
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        private void txtlocationId_KeyUp(object sender, KeyEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (e.KeyCode == Keys.Enter)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                location = txtlocationId.Text.Trim();
							 | 
						|||
| 
								 | 
							
								                txtlocationId.Text = "";
							 | 
						|||
| 
								 | 
							
								                showdata(location);
							 | 
						|||
| 
								 | 
							
								                if (dt == null || dt.Rows.Count == 0)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    return;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                lbname.Text = dt.Rows[0]["商品"].ToString(); 
							 | 
						|||
| 
								 | 
							
								                lbspec.Text = dt.Rows[0]["规格"].ToString();
							 | 
						|||
| 
								 | 
							
								                lbbatch.Text = dt.Rows[0]["批号"].ToString();
							 | 
						|||
| 
								 | 
							
								                lbcount.Text = dt.Rows[0]["数量"].ToString();
							 | 
						|||
| 
								 | 
							
								                lbunit.Text = dt.Rows[0]["单位"].ToString();
							 | 
						|||
| 
								 | 
							
								                txtlocationId.Text = dt.Rows[0]["货位"].ToString();
							 | 
						|||
| 
								 | 
							
								                lbyxq.Text = dt.Rows[0]["有效期"].ToString();
							 | 
						|||
| 
								 | 
							
								                lbshccj.Text = dt.Rows[0]["厂家"].ToString();
							 | 
						|||
| 
								 | 
							
								                stkId =Convert.ToInt32( dt.Rows[0]["id"].ToString());
							 | 
						|||
| 
								 | 
							
								                mcount = Convert.ToDecimal(lbcount.Text);
							 | 
						|||
| 
								 | 
							
								                lbbigcount.Text = dt.Rows[0]["大包装"].ToString();
							 | 
						|||
| 
								 | 
							
								                lbGoodsType.Text = dt.Rows[0]["goodstypename"].ToString();
							 | 
						|||
| 
								 | 
							
								                txtycsl.SelectAll();
							 | 
						|||
| 
								 | 
							
								                txtycsl.Focus();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                //location = dt.Rows[0]["货位"].ToString();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                ////djbh = dt.Rows[0]["单据号"].ToString();
							 | 
						|||
| 
								 | 
							
								                //number =Convert.ToInt32(dt.Rows[0]["序号"].ToString());
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)/////
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								               // GetYcsl();
							 | 
						|||
| 
								 | 
							
								                //dataGrid1.DataSource = client.getIssueData("");
							 | 
						|||
| 
								 | 
							
								                bindDg(dataGrid1, client.getIssueData(""));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								            } 
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /*
							 | 
						|||
| 
								 | 
							
								        public void GetYcsl()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            double ycsl = 0;
							 | 
						|||
| 
								 | 
							
								            DataTable dt = (DataTable)dg1.DataSource;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            if (dt.Rows.Count > 0)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                for (int i = 0; i < dt.Rows.Count; i++)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    if (dt.Rows[i][2].ToString() != null && dt.Rows[i][2].ToString() != "")
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        ycsl = ycsl + Convert.ToDouble(dt.Rows[i][2].ToString());
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            if (Convert.ToDouble(lbcount.Text.ToString()) < ycsl)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                MessageBox.Show("异常数量超过了需要养护的数量!");
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            txtycsl.Text = ycsl.ToString();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        */
							 | 
						|||
| 
								 | 
							
								        public DataTable GetDatatable()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            DataTable dt = (DataTable)dg1.DataSource;
							 | 
						|||
| 
								 | 
							
								           
							 | 
						|||
| 
								 | 
							
								            for (int i = 0; i < dt.Rows.Count;i++ )
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (dt.Rows[i][2].ToString() == "")
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    dt.Rows.RemoveAt(i);
							 | 
						|||
| 
								 | 
							
								                    i--;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								              else  if (Convert.ToDouble(dt.Rows[i][2].ToString()) <= 0)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    dt.Rows.RemoveAt(i);
							 | 
						|||
| 
								 | 
							
								                    i--;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return dt;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        private void btn_Click(object sender, EventArgs e)///保存
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            //if()
							 | 
						|||
| 
								 | 
							
								            //{
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            //}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								           
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /*
							 | 
						|||
| 
								 | 
							
								         [DllImport("Coredll.dll")]
							 | 
						|||
| 
								 | 
							
								        static extern int MapVirtualKey(uint uCode, uint uMapType);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        static char keycodetochar(Keys k)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            int i = MapVirtualKey((uint)k, 2);
							 | 
						|||
| 
								 | 
							
								            char map = Convert.ToChar(i);
							 | 
						|||
| 
								 | 
							
								            return map;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								       
							 | 
						|||
| 
								 | 
							
								        public void KeyCodeTostrYhyc(Keys k)//捕捉不合格时键盘输入的值
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            int m = dg1.CurrentRowIndex;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            char ca = keycodetochar(k);
							 | 
						|||
| 
								 | 
							
								            string str = ca.ToString();
							 | 
						|||
| 
								 | 
							
								            if (Char.IsWhiteSpace(ca) || string.IsNullOrEmpty(str) || ca == '\r' || ca == '\n' || ca == keycodetochar(Keys.F1))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                if (dg1.CurrentCell.ColumnNumber == 2)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    try
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        if (ca == '\b')
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            dg1[m, 2] = "";
							 | 
						|||
| 
								 | 
							
								                            return;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        else if (ca == '.')
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            str = ".";
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        else if (decimal.Parse(str) < 0)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            str = "";
							 | 
						|||
| 
								 | 
							
								                            return;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    catch
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        str = "";
							 | 
						|||
| 
								 | 
							
								                        return;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    dg1[m, 2] = dg1[m, 2] + str;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								               
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        private void dg1_KeyDown(object sender, KeyEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Keys k = (Keys)e.KeyData;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                KeyCodeTostrYhyc(k);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								         * */
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            if(e.KeyChar==13)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                loca = textBox1.Text;
							 | 
						|||
| 
								 | 
							
								                textBox1.Text="";
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								              // dataGrid1.DataSource= client.getIssueData(loca);
							 | 
						|||
| 
								 | 
							
								               
							 | 
						|||
| 
								 | 
							
								                Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
							 | 
						|||
| 
								 | 
							
								                try
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    bindDg(dataGrid1, client.getIssueData(loca));
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                catch (Exception er)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								                    MessageBox.Show("发生错误:" + er.Message);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                
							 | 
						|||
| 
								 | 
							
								               textBox1.Focus();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        private void button1_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            bool b = false;
							 | 
						|||
| 
								 | 
							
								            Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								               b =  client.fixIssueData(loca,goodsId,batch,LoginInfo.UserId,LoginInfo.Token);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception er)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								                MessageBox.Show("发生错误:" + er.Message);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            if (b)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                MessageBox.Show("解锁成功!!");
							 | 
						|||
| 
								 | 
							
								                loca = "";
							 | 
						|||
| 
								 | 
							
								                //dataGrid1.DataSource = client.getIssueData("");
							 | 
						|||
| 
								 | 
							
								                bindDg(dataGrid1, client.getIssueData(loca));
							 | 
						|||
| 
								 | 
							
								                textBox1.Focus();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                MessageBox.Show("解锁失败!!");
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        private void txtycsl_KeyUp(object sender, KeyEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (e.KeyCode == Keys.Enter)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                newMaintain();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        void newMaintain()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (lbname.Text.Trim() == "")
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    MessageBox.Show("无数据!");
							 | 
						|||
| 
								 | 
							
								                    return;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                if (cb1.Checked || cb2.Checked || cb3.Checked || cb4.Checked || cb5.Checked || cb6.Checked || cb7.Checked || cb8.Checked)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    decimal ycsl = Convert.ToDecimal(txtycsl.Text.Trim());
							 | 
						|||
| 
								 | 
							
								                    if (ycsl < 0)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        MessageBox.Show("异常数不能小于0!");
							 | 
						|||
| 
								 | 
							
								                        return;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    if (ycsl > Convert.ToDecimal(lbcount.Text.Trim()))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        MessageBox.Show("异常数不能大于养护数!");
							 | 
						|||
| 
								 | 
							
								                        return;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    string yhcs = "";
							 | 
						|||
| 
								 | 
							
								                    //    string fd="否",wg="否",cs="否",js="否",sw="否",jw="否",tf="否",cc="否";
							 | 
						|||
| 
								 | 
							
								                    if (cb1.Checked)
							 | 
						|||
| 
								 | 
							
								                        yhcs = yhcs + "翻跺;";
							 | 
						|||
| 
								 | 
							
								                    if (cb2.Checked)
							 | 
						|||
| 
								 | 
							
								                        yhcs = yhcs + "外观;";
							 | 
						|||
| 
								 | 
							
								                    if (cb3.Checked)
							 | 
						|||
| 
								 | 
							
								                        yhcs = yhcs + "除湿;";
							 | 
						|||
| 
								 | 
							
								                    if (cb4.Checked)
							 | 
						|||
| 
								 | 
							
								                        yhcs = yhcs + "加湿;";
							 | 
						|||
| 
								 | 
							
								                    if (cb5.Checked)
							 | 
						|||
| 
								 | 
							
								                        yhcs = yhcs + "升温;";
							 | 
						|||
| 
								 | 
							
								                    if (cb6.Checked)
							 | 
						|||
| 
								 | 
							
								                        yhcs = yhcs + "降温;";
							 | 
						|||
| 
								 | 
							
								                    if (cb7.Checked)
							 | 
						|||
| 
								 | 
							
								                        yhcs = yhcs + "通风;";
							 | 
						|||
| 
								 | 
							
								                    if (cb8.Checked)
							 | 
						|||
| 
								 | 
							
								                        yhcs = yhcs + "除尘;";
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                  //  DataTable dta = GetDatatable();
							 | 
						|||
| 
								 | 
							
								                    bool b_result; 
							 | 
						|||
| 
								 | 
							
								                    Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
							 | 
						|||
| 
								 | 
							
								                    try
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        b_result = client.newMaintain(stkId, mcount, ycsl, yhcs, LoginInfo.UserId, LoginInfo.Token);// bll.UpdateErpMaintain(location, txtycsl.Text, yhcs, Main.login_rolename, dta);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    catch (Exception er)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								                        MessageBox.Show("发生错误:" + er.Message);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        return;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    Cursor.Current = System.Windows.Forms.Cursors.Default;
							 | 
						|||
| 
								 | 
							
								                    
							 | 
						|||
| 
								 | 
							
								                    
							 | 
						|||
| 
								 | 
							
								                    
							 | 
						|||
| 
								 | 
							
								                    
							 | 
						|||
| 
								 | 
							
								                    if (b_result)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        showdata("");
							 | 
						|||
| 
								 | 
							
								                        clear();
							 | 
						|||
| 
								 | 
							
								                        MessageBox.Show("确认成功!");
							 | 
						|||
| 
								 | 
							
								                        txtlocationId.Focus();
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    else
							 | 
						|||
| 
								 | 
							
								                        MessageBox.Show("确认失败!");
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    MessageBox.Show("请选择养护措施!");
							 | 
						|||
| 
								 | 
							
								                    return;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                MessageBox.Show("异常数格式有误!");
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								           
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |