Exemplo n.º 1
0
 private void txt_PutAwayBill_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         DataSet ds = new DB().GetPutAway(this.txt_PutAwayBill.Text.ToUpper().Trim());
         if (ds == null)
         {
             MessageBox.Show("获取数据失败,请检查网络!");
         }
         else
         {
             if (ds.Tables["PutAwayBill"].Rows.Count == 0)
             {
                 MessageBox.Show("上架单不存在或此上架单已完成上架!");
                 this.txt_PutAwayBill.Text = string.Empty;
                 this.txt_PutAwayBill.Focus();
             }
             else
             {
                 PutAway.DataSource = ds;
                 this.dg_PutAway.DataSource = ds.Tables["PutAwayBill"];
                 this.lbl_PutAway.Text = "上架单:" + this.txt_PutAwayBill.Text;
                 this.txt_PutAwayBill.Text = string.Empty;
                 this.txt_PutAwayBill.Focus();
             }
         }
     }
 }
Exemplo n.º 2
0
 private void txt_OldLot_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         DataSet ds = new DB().GetMoveLotData(this.txt_MoveLotBill.Text.ToUpper().Trim(), this.txt_OldLot.Text.ToUpper().Trim());
         if (ds == null)
         {
             MessageBox.Show("获取数据失败,请检查网络!");
         }
         else
         {
             if (ds.Tables["MoveLotBill"].Rows.Count == 0)
             {
                 MessageBox.Show("移储单不存在或者此移储单已经处理完毕!");
                 this.txt_MoveLotBill.Text = string.Empty;
                 this.txt_MoveLotBill.Focus();
                 return;
             }
             else if (ds.Tables["MoveLotDisk"].Rows.Count == 0)
             {
                 MessageBox.Show("当前批次已处理完毕!");
                 this.txt_MoveLotBill.Text = string.Empty;
                 this.txt_MoveLotBill.Focus();
                 return;
             }
             else
             {
                 dg_MoveLot.DataSource = ds.Tables["MoveLotBill"];
                 MoveLot.DataSource = ds;
             }
         }
     }
 }
Exemplo n.º 3
0
 private void btn_OK_Click(object sender, EventArgs e)
 {
     if (this.txt_ASN.Text.Trim() == string.Empty && this.txt_Disk.Text.Trim() == string.Empty && this.txt_SKU.Text.Trim() == string.Empty)
     {
         MessageBox.Show("请至少输入一个查询条件!");
     }
     else
     {
         DataSet ds = new DataSet();
         ds = new DB().GetDiskList(this.txt_Disk.Text.ToUpper().Trim(), this.txt_SKU.Text.ToUpper().Trim(), System.DateTime.Now, this.txt_ASN.Text.ToUpper().Trim());
         DiskList dl = new DiskList(ds);
         dl.Show();
         dl.Closed += new EventHandler(dl_Closed);
         this.Hide();
     }
 }
Exemplo n.º 4
0
 private void txt_Disk_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         this.txt_Detail.Text = string.Empty;
         try
         {
             string msg = new DB().GetAndSaveDiskForBegin(this.txt_Disk.Text.ToUpper().Trim(), "DRY");
             this.txt_Detail.Text = msg.Replace("\n", "\r\n");
         }
         catch (Exception ex)
         {
             this.txt_Detail.Text = ex.Message;
         }
         this.txt_Disk.Text = string.Empty;
         this.txt_Disk.Focus();
     }
 }
Exemplo n.º 5
0
 private void txt_OldLoc_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         DataSet ds = new DB().GetMoveLocData(txt_OldLoc.Text.ToUpper().Trim());
         if (ds == null)
         {
             MessageBox.Show("获取数据失败,请检查网络!");
             txt_OldLoc.Text = string.Empty;
             return;
         }
         if (ds.Tables[0].Rows.Count == 0)
         {
             MessageBox.Show("该库位无物料,请重新扫描!");
             txt_OldLoc.Text = string.Empty;
             return;
         }
         MoveLoc.DataSource = ds;
         this.dg_DiskList.DataSource = ds.Tables["DiskList"];
         this.lbl_OldLocNo.Text = txt_OldLoc.Text.ToUpper().Trim();
         txt_OldLoc.Text = string.Empty;
     }
 }
Exemplo n.º 6
0
        private void btn_UpdataBaseData_Click(object sender, EventArgs e)
        {
            DataSet ds = new DB().GetFactoryAndStorage();
            if (ds == null || ds.Tables.Count < 2)
            {
                MessageBox.Show("获取数据失败,请检查网络!");
                return;
            }
            StringBuilder sql = new StringBuilder();
            sql.Append("delete from mydicts;");
            sql.Append("insert into mydicts(dicttype,dictvalue,dicttext) ");
            foreach (DataRow dr in ds.Tables["Factory"].Rows)
            {
                sql.AppendFormat(System.Globalization.CultureInfo.CurrentCulture, "select '{0}','{1}','{2}' union all ", 1, dr["id"], dr["name"]);
            }
            foreach (DataRow dr in ds.Tables["Storage"].Rows)
            {
                sql.AppendFormat(System.Globalization.CultureInfo.CurrentCulture, "select '{0}','{1}','{2}' union all ", 2, dr["id"], dr["name"]);
            }
            if (sql.Length == 0) return;
            sql.Length = sql.Length - "union all ".Length;
            if (SqliteDbFactory.GetSqliteDbOperator().BatchExecute(sql.ToString().Split(";".ToCharArray())) == 0)
            {
                MessageBox.Show("同步基础数据失败,请检查网络!");
                return;
            }

            ds = new DB().GetLoc();
            sql.Length = 0;
            sql.Append("delete from kuweiinfo;");
            sql.Append("insert into kuweiinfo(kuweicode) ");
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                sql.AppendFormat(System.Globalization.CultureInfo.CurrentCulture, "select '{0}' union all ", dr["loc"]);
            }
            if (sql.Length == 0) return;
            sql.Length = sql.Length - "union all ".Length;
            if (SqliteDbFactory.GetSqliteDbOperator().BatchExecute(sql.ToString().Split(";".ToCharArray())) == 0)
            {
                MessageBox.Show("同步基础数据失败,请检查网络!");
                return;
            }
            MessageBox.Show("同步基础数据成功!");
        }
Exemplo n.º 7
0
        private bool UpdateUserData()
        {
            DataSet ds = new DB().GetUserAndFunction();
            if (ds == null || ds.Tables.Count < 2)
            {
                MessageBox.Show("获取数据失败,请检查网络!");
                return false;
            }

            ds.Tables["User"].Columns.Add("rightstr", typeof(string));

            foreach (DataRow dr in ds.Tables["Function"].Rows)
            {
                DataRow[] drs = ds.Tables["User"].Select(string.Format("USER_CODE = '{0}'", dr["USER_CODE"]));
                if (drs.Length == 0) { continue; }
                drs[0]["rightstr"] = drs[0]["rightstr"] is DBNull ? dr["FUNCTION_CODE"].ToString() : drs[0]["rightstr"].ToString() + "," + dr["FUNCTION_CODE"].ToString();
            }

            StringBuilder sql = new StringBuilder();
            sql.Append("delete from myUsers;");
            sql.Append("insert into myUsers(name,pwd,rightstr) ");
            foreach (DataRow dr in ds.Tables["User"].Rows)
            {
                sql.AppendFormat(System.Globalization.CultureInfo.CurrentCulture, "select '{0}','{1}','{2}' union all ", dr["USER_CODE"], dr["USER_PWD"], dr["rightstr"]);
            }
            sql.Length = sql.Length - "union all ".Length;
            SqliteDbFactory.GetSqliteDbOperator().BatchExecute(sql.ToString().Split(";".ToCharArray()));
            return true;
        }