示例#1
0
        //上传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);
        }
示例#2
0
        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);
        }