//查询 private void buttonX2_Click(object sender, EventArgs e) { int k = 0; if (checkBoxX1.Checked == true) { k = 1; } //this.dateTimePicker1.Format = DateTimePickerFormat.Custom; //this.dateTimePicker1.CustomFormat = "yyyy年MM月dd日 "; //this.dateTimePicker1.ShowUpDown = true; DateTime tem = dateTimePicker1.Value; string year = tem.Year.ToString(); string month = tem.Month.ToString(); string day = tem.Day.ToString(); string date = year + "/" + month + "/" + day; //MessageBox.Show(tem.ToString().Substring(0, 9) + " 00:00:00"); //String ss = tem.ToString().Substring(0, 10).Trim() + " 00:00:00"; String ss = date + " 00:00:00"; tem = DateTime.Parse(ss); this.displaydatagridview(EY_Scale_Value_Dao.SearchByTime(tem, tem.AddHours(24), k)); }
//上传ERP private void buttonX1_Click(object sender, EventArgs e) { string mess = ""; int k = 0; int count = Convert.ToInt32(this.dataGridViewX1.Rows.Count.ToString()); for (int i = 0; i < count; i++) { DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)this.dataGridViewX1.Rows[i].Cells["Column2"]; Boolean flag = Convert.ToBoolean(checkCell.Value); if (flag == true) { if (this.dataGridViewX1.Rows[i].Cells[6].Value.ToString().Trim() == "未上传") { string date = Convert.ToDateTime(this.dataGridViewX1.Rows[i].Cells[1].Value).ToString("yyyyMMddHHmmss").Substring(0, 8).Trim(); string time = Convert.ToDateTime(this.dataGridViewX1.Rows[i].Cells[1].Value).ToString("yyyyMMddHHmmss").Substring(8, 6).Trim(); double water = Convert.ToDouble(this.dataGridViewX1.Rows[i].Cells[5].Value); string str1 = water.ToString("0.00"); mess = "N" + "###" + this.dataGridViewX1.Rows[i].Cells[2].Value.ToString().Trim() + "###" + str1 + "###" + date + "###" + time; tbdipdo tbdipdo = new tbdipdo(); tbdipdo.TimeStamp = Convert.ToDecimal(DateTime.Now.ToString("yyyyMMddHHmmss")); tbdipdo.Status = "N"; tbdipdo.SerialNo = Convert.ToDecimal(k); tbdipdo.Header = "192.168.100.92" + "PJKFPTC" + DateTime.Now.ToString("yyyyMMddHHmmss"); tbdipdo.QueueId = "PJKFPTC"; tbdipdo.Data = mess; tbdipdo_DAO.TBDIPDOSAVE(tbdipdo); try { EY_Scale_Value_PK SPL = new EY_Scale_Value_PK(); SPL.RegNo = Convert.ToString(this.dataGridViewX1.Rows[i].Cells[2].Value); SPL.CheckNo = Convert.ToString(this.dataGridViewX1.Rows[i].Cells[3].Value); EY_Scale_Value_Dao.Update_ToErpFlag(SPL, "1"); } catch (Exception ex) { MessageBox.Show(ex.Message); } //EY_Scale_Value_PK SPL = new EY_Scale_Value_PK(); //SPL.RegNo = Convert.ToString(this.dataGridViewX1.Rows[i].Cells[2].Value); //SPL.CheckNo = Convert.ToString(this.dataGridViewX1.Rows[i].Cells[3].Value); //EY_Scale_Value_Dao.Update_ToErpFlag(SPL, "1"); k++; } } } MessageBox.Show("上传成功" + k.ToString() + "笔数据"); IList <EY_Scale_Value> EY_Scale_Value = EY_Scale_Value_Dao.GetScaleToErp("0"); displaydatagridview(EY_Scale_Value); }
private void UPLoad_Load(object sender, EventArgs e) { IList <EY_Scale_Value> EY_Scale_Value = EY_Scale_Value_Dao.GetScaleToErp("0"); displaydatagridview(EY_Scale_Value); }