private void button1_Click(object sender, EventArgs e) { label2.Visible = true; label2.Text = "查询中..."; try { // BaseAccess dbhelper = BaseAccess.CreateDataBase(); // DataTable dt= dbhelper.GetDataTable("".AsSQLQuery() + "select Top 1 * from WMS_SYS_USERS"); //if (dt != null // && dt.Rows != null // && dt.Rows.Count > 0) //{ // MessageBox.Show("成功!"); BaseAccess dbhelper = BaseAccess.CreateDataBase(); DataTable dt = dbhelper.GetDataTable("".AsSQLQuery() + "select * from view_Loc_needcheck "); if (dt != null) { dataGridView1.DataSource = dt; label2.Text = "" + (dataGridView1.Rows.Count - 1).ToString() + "条"; } else { MessageBox.Show("未获取到数据!"); } } catch (Exception ex) { MessageBox.Show("异常" + ex.Message); } }
private void toolStripButton1_Click(object sender, EventArgs e) { if ((listView2.SelectedItems != null) && (listView2.SelectedItems.Count == 0)) { MessageBox.Show("请选择要取消的任务"); } else { BaseAccess dbhelper = BaseAccess.CreateDataBase(); var entity = listView2.SelectedItems[0].Tag as WMS_IO_Task; entity.Status = "5"; entity.EditUser = "******"; entity.Remark = "程序取消"; entity.EditTime = System.DateTime.Now.ToString(CommFinal.TimeFormat); if (dbhelper.Update(entity) > 0) { //DataTable dt = dbhelper.GetDataTable("".AsSQLQuery() + "update wms_B_loc set status=2 where locnum="+entity."" MessageBox.Show("取消成功"); listView2.Items.Clear(); } else { MessageBox.Show("请确认任务状态"); } } }
private void button1_Click_1(object sender, EventArgs e) { label3.Visible = true; BaseAccess dbhelper = BaseAccess.CreateDataBase(); //DataTable dt1 = dbhelper.GetDataTable("".AsSQLQuery() + " select '' as'完成日期', '' as'完成月份', '' as'时间段', '' as' 数量'"); //dataGridView2.DataSource = dt1; try { // BaseAccess dbhelper = BaseAccess.CreateDataBase(); DataTable dt = dbhelper.GetDataTable("".AsSQLQuery() + "select CompletedDate as 完成日期,CompletedMonth as 完成月份,CompletedHour as 时间段,OutCount as 数量 from View_HourPickInfo where CompletedDate between '" + dateTimePicker1.Text + "' and '" + dateTimePicker2.Text + "'order by CompletedDate,CompletedHour"); if (dt != null) { dataGridView2.DataSource = dt; label3.Text = "" + (dataGridView2.Rows.Count - 1).ToString() + "小时"; } else { MessageBox.Show("未获取到数据!"); } double j = 0; for (int i = 0; i < dataGridView2.Rows.Count - 1; i++) { j += Convert.ToDouble(dataGridView2.Rows[i].Cells["数量"].Value); //rowtemp.CreateCell(1).SetCellValue(dgv.Rows[i].Cells["Capital_assets_Name_G"].Value.ToString()); //rowtemp.CreateCell(2).SetCellValue(dgv.Rows[i].Cells["Capital_assets_Code_G"].Value.ToString()); //rowtemp.CreateCell(3).SetCellValue(dgv.Rows[i].Cells["Capital_assets_Model_G"].Value.ToString()); } label4.Visible = true; label4.Text = "总计:" + j.ToString() + "种"; } catch (Exception ex) { MessageBox.Show("异常" + ex.Message); } }
public void Datalistview() { List <WMS_IO_Task> list = new List <WMS_IO_Task>(); BaseAccess dbhelper = BaseAccess.CreateDataBase(); string sql = "select * from wms_IO_task where status=1 and tasktype='2' and binding_flag=3 and taskId='" + textBox2.Text + "'"; list = dbhelper.GetList <WMS_IO_Task>("".AsSQLQuery() + sql); if (list.Count <= 0) { MessageBox.Show("未查询到该抽盘任务,请确认任务是否满足"); } else { this.listView2.Items.Clear(); if (list.Count > 0) { Invoke(new Action(() => { for (int i = 0; i < list.Count; i++) { ListViewItem item = new ListViewItem(); item.Tag = list[i]; item.Text = list[i].TaskId; item.SubItems.Add(list[i].PalletNo); item.SubItems.Add(list[i].SourceLoc); item.SubItems.Add(list[i].TargetLoc); item.SubItems.Add(list[i].CratedTime); item.SubItems.Add(list[i].EditUser); item.SubItems.Add(list[i].EditTime); listView2.Items.Add(item); } })); } } }
private void button1_Click(object sender, EventArgs e) { PageCondition.Visible = true; BaseAccess dbhelper = BaseAccess.CreateDataBase(); dbhelper.ExecuteNonQuerySQL("".AsSQLQuery() + "delete ZBO"); if (dbhelper.Insert <Excel>(excels) > 0) { lvw.Clear(); lvw.Items.Clear(); lvw.Columns.AddRange(new ColumnHeader[] { new ColumnHeader { Text = "物料编码", Width = 100, TextAlign = HorizontalAlignment.Center }, new ColumnHeader { Text = "物料名称", Width = 100, TextAlign = HorizontalAlignment.Center }, new ColumnHeader { Text = "在库数量", Width = 100, TextAlign = HorizontalAlignment.Center }, new ColumnHeader { Text = "待验收数量", Width = 100, TextAlign = HorizontalAlignment.Center }, new ColumnHeader { Text = "一次验收完成数量", Width = 110, TextAlign = HorizontalAlignment.Center }, new ColumnHeader { Text = "二次验收完成数量", Width = 110, TextAlign = HorizontalAlignment.Center }, new ColumnHeader { Text = "入库待处理数量", Width = 110, TextAlign = HorizontalAlignment.Center }, }); PageCondition.PageSize = 50; PageCondition.SqlSort = "order by MaterialId"; listTask = dbhelper.GetList <MaterialStatus>("".AsSQLQuery() + "select * from View_ZBO", PageCondition.PageCondition); page = listTask.rows.Count(); PageCondition.DataQuery(new Func <int>(() => { if (listTask != null && listTask.rows != null && listTask.rows.Count > 0) { Invoke(new Action(() => { lvw.Items.Clear(); for (int i = 0; i < listTask.rows.Count; i++) { ListViewItem item = new ListViewItem(); item.Tag = listTask.rows[i]; item.Text = listTask.rows[i].MaterialId; item.SubItems.Add(listTask.rows[i].MaterialName); item.SubItems.Add(listTask.rows[i].AllQuantity); item.SubItems.Add(listTask.rows[i].Checkquantity); item.SubItems.Add(listTask.rows[i].FCheckquantity); item.SubItems.Add(listTask.rows[i].SCheckquantity); item.SubItems.Add(listTask.rows[i].Inquantity); lvw.Items.Add(item); } })); } return(listTask == null ? 0 : listTask.total); }), true); } else { MessageBox.Show("请重试", "提示"); } buttonoutport.Visible = true; }
private void button1_Click(object sender, EventArgs e) { label2.Visible = true; dateTimePicker2.Value.AddDays(+1).ToString(); if (textBox1.Text.Length > 17) { MessageBox.Show("请输入正确的订单号"); } else { BaseAccess dbhelper = BaseAccess.CreateDataBase(); DataTable dt = dbhelper.GetDataTable("".AsSQLQuery() + "select TagInfo,Printtime from WMS_W_TagPrintLog where PrintResult=0 and TagInfo like '%出库%" + textBox1.Text + "%' and (Printtime >='" + dateTimePicker1.Text + "'and Printtime<= '" + dateTimePicker2.Value.AddDays(+1).ToString() + "')"); string[] a = new string[dt.Rows.Count]; DataTable dt2 = new DataTable(); dt2.Columns.Add(new DataColumn("合并订单号", typeof(string))); dt2.Columns.Add(new DataColumn("物料编码", typeof(string))); dt2.Columns.Add(new DataColumn("物料名称", typeof(string))); // dt2.Columns.Add(new DataColumn("出库条码", typeof(string))); dt2.Columns.Add(new DataColumn("库区", typeof(string))); dt2.Columns.Add(new DataColumn("订单号", typeof(string))); dt2.Columns.Add(new DataColumn("出库条码", typeof(string))); dt2.Columns.Add(new DataColumn("打印时间", typeof(string))); for (int i = 0; i < dt.Rows.Count; i++) { // a[i] = dt.Rows[i][0].ToString(); string[] cc = dt.Rows[i][0].ToString().Split(new char[] { ':', ',' }); if (cc.Length == 62) { string c = cc[19].Substring(1, cc[19].Length - 2); string b = cc[17].Substring(1, cc[17].Length - 2); string d = cc[15].Substring(1, cc[15].Length - 2); //string e1 = cc[13].Substring(1, cc[13].Length - 2); string e2 = cc[39].Substring(1, cc[39].Length - 2); string e3 = cc[21].Substring(1, cc[21].Length - 2); string e4 = cc[7].Substring(1, cc[7].Length - 2); string e5 = dt.Rows[i][1].ToString(); dt2.Rows.Add(c, b, d, e2, e3, e4, e5); } //if(cc.Length==57) //{ // string c = cc[17].Substring(1, cc[17].Length - 2); // string b = cc[15].Substring(1, cc[15].Length - 2); // string d = cc[13].Substring(1, cc[13].Length - 2); // //string e1 = cc[13].Substring(1, cc[13].Length - 2); // string e2 = cc[37].Substring(1, cc[37].Length - 2); // string e3 = cc[17].Substring(1, cc[17].Length - 2); // string e4 = cc[7].Substring(1, cc[7].Length - 2); // string e5 = dt.Rows[i][1].ToString(); // dt2.Rows.Add(c, b, d, e2, e3, e4, e5); //} if (cc.Length == 56) { string c = cc[15].Substring(1, cc[15].Length - 2); string b = cc[13].Substring(1, cc[13].Length - 2); string d = cc[11].Substring(1, cc[11].Length - 2); //string e1 = cc[13].Substring(1, cc[13].Length - 2); string e2 = cc[35].Substring(1, cc[35].Length - 2); string e3 = cc[17].Substring(1, cc[17].Length - 2); string e4 = cc[7].Substring(1, cc[7].Length - 2); string e5 = dt.Rows[i][1].ToString(); dt2.Rows.Add(c, b, d, e2, e3, e4, e5); } } // string[] ss= a[0].Split(new char[] {':',',' }); //dataGridView1.Rows[0].Cells[0].Value = ss[21]; // dt2.Rows.Add("dsadsad"); dataGridView1.DataSource = dt2; dataGridView1.Columns["合并订单号"].Width = 130; dataGridView1.Columns["出库条码"].Width = 130; dataGridView1.Columns["打印时间"].Width = 130; label2.Text = "共" + dt2.Rows.Count.ToString() + "记录"; } }