/// <summary>
 /// 双击选择
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void lvwUserList_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         if (this.lvwUserList.SelectedRows.Count == 1)
         {
             bool istru = false;
             if (comboxCarType.Text.Trim() == "送货车辆")
             {
                 istru = CommonalityEntity.AddPOInfo(this.lvwUserList.SelectedRows[0].Cells["EBELN"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["NAME1_P"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["MAKTX"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["KDATB"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["KDATE"].Value.ToString(), 0, CheckProperties.ce.SapSongHuoTable2);
             }
             if (comboxCarType.Text.Trim() == "成品车辆")
             {
                 string carName = this.lvwUserList.SelectedRows[0].Cells["CARNO"].Value.ToString();
                 string wtdid   = this.lvwUserList.SelectedRows[0].Cells["WTD_ID"].Value.ToString();
                 if (IsSapNo(carName, wtdid))
                 {
                     MessageBox.Show("该车辆的订单号业务已完成,不能重复登记!");
                     return;
                 }
                 if (this.lvwUserList.SelectedRows[0].Cells["O_FLAG"].Value.ToString() != "X")
                 {
                     MessageBox.Show("没有装货通知单,不能登记!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
                     return;
                 }
                 istru = CommonalityEntity.AddWTDIDInfo(this.lvwUserList.SelectedRows[0].Cells["CARNO"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["WTD_ID"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["O_FLAG"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["TEL_NUMBER"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["HG"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["XZ"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["KDATB"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["KDATE"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["NAME1_C"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["NAME1_P"].Value.ToString(), 0, this.lvwUserList.SelectedRows[0].Cells["Prodh"].Value.ToString(), CheckProperties.ce.SapChengPinTable2);
             }
             if (comboxCarType.Text.Trim() == "三废车辆")
             {
                 istru = CommonalityEntity.AddSAPVBELNInfo(this.lvwUserList.SelectedRows[0].Cells["VBELN"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["NAME1_C"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["MAKTX"].Value.ToString(), 0, CheckProperties.ce.SapSangFeiTable2);
             }
             if (istru)
             {
                 istru = false;
                 CommonalityEntity.ISsap = true;
                 CarInfoForm cif = new CarInfoForm();
                 cif.Show();
                 this.Close();
             }
         }
         else
         {
             MessageBox.Show("请选择车辆!");
         }
     }
     catch (Exception ex)
     {
         CommonalityEntity.WriteTextLog("SAP:" + ex.Message);
     }
 }
        /// <summary>
        /// 校验登记
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnChkSAP_Click(object sender, EventArgs e)
        {
            try
            {
                CommonalityEntity.IsUpdatedri        = false;
                CheckProperties.ce.SapSangFeiTable   = null;
                CheckProperties.ce.SapSongHuoTable   = null;
                CheckProperties.ce.SapChengPinTable  = null;
                CheckProperties.ce.SapSangFeiTable2  = null;
                CheckProperties.ce.SapSongHuoTable2  = null;
                CheckProperties.ce.SapChengPinTable2 = null;

                if (comboxCarType.Text.Trim() == "")
                {
                    MessageBox.Show("车辆类型不能为空!");
                    return;
                }
                if (txtNumber.Text.Trim() == "")
                {
                    MessageBox.Show(lblNumber.Text.ToString());
                    return;
                }
                CheckMethod.listMessage.Clear();
                //给需要执行的管控赋值
                EMEWE.CarManagement.Commons.CommonClass.CheckProperties.CommonEntity comm = new EMEWE.CarManagement.Commons.CommonClass.CheckProperties.CommonEntity();
                if (comboxCarType.Text == "送货车辆")
                {
                    comm.SongHuoNumber = txtNumber.Text.Trim();
                }
                else if (comboxCarType.Text == "成品车辆")
                {
                    comm.ChengPinNumber = txtNumber.Text.Trim();
                }
                else if (comboxCarType.Text == "三废车辆")
                {
                    comm.SangFeiNumber = txtNumber.Text.Trim();
                }
                comm.CarType_Name  = comboxCarType.Text.Trim();
                CheckProperties.ce = comm;
                //执行管控
                if (comboxCarType.Text == "送货车辆")
                {
                    CheckMethod.ChkSongHuo();
                    CheckMethod.ChkSongHuoFour();
                }
                else if (comboxCarType.Text == "成品车辆")
                {
                    CheckMethod.ChkChengPin();
                }
                else if (comboxCarType.Text == "三废车辆")
                {
                    CheckMethod.ChkSanFei();
                }
                //执行结果
                if (CheckMethod.listMessage.Count > 0)
                {
                    string strmessage = "";
                    foreach (var item in CheckMethod.listMessage)
                    {
                        strmessage += item;
                    }
                    MessageBox.Show(this, strmessage);;
                    return;
                }
                bool istru = false;
                if (CheckProperties.ce.SapSangFeiTable != null)
                {
                    lvwUserList.DataSource = CheckProperties.ce.SapSangFeiTable;
                    if (CheckProperties.ce.SapSangFeiTable2.Rows[0][0].ToString() == "S" && CheckProperties.ce.SapSangFeiTable.Rows.Count == 1)
                    {
                        istru = CommonalityEntity.AddSAPVBELNInfo(this.lvwUserList.SelectedRows[0].Cells["VBELN"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["NAME1_C"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["MAKTX"].Value.ToString(), 0, CheckProperties.ce.SapSangFeiTable2);
                    }
                }
                if (CheckProperties.ce.SapSongHuoTable != null)
                {
                    lvwUserList.DataSource = CheckProperties.ce.SapSongHuoTable;
                    if (CheckProperties.ce.SapSongHuoTable2.Rows[0][0].ToString() == "S" && CheckProperties.ce.SapSongHuoTable.Rows.Count == 1)
                    {
                        istru = CommonalityEntity.AddPOInfo(this.lvwUserList.SelectedRows[0].Cells["EBELN"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["NAME1_P"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["MAKTX"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["KDATB"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["KDATE"].Value.ToString(), 0, CheckProperties.ce.SapSongHuoTable2);
                    }
                }
                if (CheckProperties.ce.SapChengPinTable != null)
                {
                    lvwUserList.DataSource = CheckProperties.ce.SapChengPinTable;
                    if (CheckProperties.ce.SapChengPinTable2.Rows[0][0].ToString() == "S" && CheckProperties.ce.SapChengPinTable.Rows.Count == 1)
                    {
                        string carName = this.lvwUserList.SelectedRows[0].Cells["CARNO"].Value.ToString();
                        string wtdid   = this.lvwUserList.SelectedRows[0].Cells["WTD_ID"].Value.ToString();
                        if (IsSapNo(carName, wtdid))
                        {
                            MessageBox.Show(this, "该车辆的订单号业务已完成,不能重复登记!");
                            return;
                        }
                        if (this.lvwUserList.SelectedRows[0].Cells["O_FLAG"].Value.ToString() != "X")
                        {
                            MessageBox.Show("没有装货通知单,不能登记!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
                            return;
                        }
                        istru = CommonalityEntity.AddWTDIDInfo(this.lvwUserList.SelectedRows[0].Cells["CARNO"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["WTD_ID"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["O_FLAG"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["TEL_NUMBER"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["HG"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["XZ"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["KDATB"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["KDATE"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["NAME1_C"].Value.ToString(), this.lvwUserList.SelectedRows[0].Cells["NAME1_P"].Value.ToString(), 0, this.lvwUserList.SelectedRows[0].Cells["Prodh"].Value.ToString(), CheckProperties.ce.SapChengPinTable2);
                    }
                }
                if (istru)
                {
                    istru = false;
                    CommonalityEntity.ISsap = true;
                    CarInfoForm cif = new CarInfoForm();
                    cif.Show();
                    this.Close();
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("SAPCarInfoForm btnChkSAP_Click()");
            }
        }