示例#1
0
        // 上报已修改的信息
        private void barUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!Utils.CheckUser())
            {
                return;
            }
            try
            {
                //获取上报修改的数据
                List <string> vinList = new List <string>();
                this.dgvCljbxx.DefaultView.PostEditor();
                DataTable dt = (DataTable)this.dgvCljbxx.DataSource;
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        bool result = false;
                        bool.TryParse(dt.Rows[i]["check"].ToString(), out result);
                        if (result)
                        {
                            string vin = String.Format("'{0}'", dt.Rows[i]["vin"]);
                            vinList.Add(vin);
                        }
                    }
                }
                if (vinList == null || vinList.Count < 1)
                {
                    MessageBox.Show("请选择要上报修改的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                ReasonForm rf = new ReasonForm();
                Utils.SetFormMid(rf);
                rf.Text = "修改原因";
                rf.ShowDialog();

                //Utils.Open("UPDATE");

                if (rf.DialogResult == DialogResult.OK)
                {
                    pf = new ProcessForm();
                    pf.Show();

                    // 发出修改
                    List <OperateResult> orList = this.ApplyParamMultiRows(vinList, rf.Reason);
                    //FuelDataSysClient.FuelDataService.OperateResult sor = service.ApplyUpdate(Utils.userId, Utils.password, Utils.FuelInfoC2S(vbiList).ToArray(), "CATARC_CUSTOM_2012");
                    //OperateResult or = Utils.OperateResultS2C(sor);

                    // 获取修改结果
                    List <string>               vinsSucc    = new List <string>();
                    List <NameValuePair>        vinsFail    = new List <NameValuePair>();
                    Dictionary <string, string> dSuccVinVid = new Dictionary <string, string>();
                    //Utils.getOperateResultVins(or, vinsSucc, vinsFail, dSuccVinVid);
                    Utils.getOperateResultListVins(orList, vinsSucc, vinsFail, dSuccVinVid);

                    string strSucc = "";// "备案号(VIN):返回码(VID)";
                    // 修改本地状态为“0:已上报”
                    if (vinsSucc.Count > 0)
                    {
                        string strUpdate = "";
                        for (int i = 0; i < vinsSucc.Count; i++)
                        {
                            strUpdate += String.Format(",'{0}'", vinsSucc[i]);
                            strSucc   += String.Format("备案号(VIN):{0},\r反馈码(VID):{1}, \r成功 \r\n", vinsSucc[i], dSuccVinVid[vinsSucc[i]]);
                        }
                        //Utils.setStatusForUpload(strUpdate.Substring(1), "0");
                        //// 反馈码入库
                        //Utils.setVidForUpload(dSuccVinVid);

                        Utils.setVidStatusForUpload(dSuccVinVid);

                        // 刷新当前页面
                        this.searchLocal();
                    }
                    string strFail = "";
                    if (vinsFail.Count > 0)
                    {
                        for (int i = 0; i < vinsFail.Count; i++)
                        {
                            strFail += String.Format("备案号(VIN):{0}, \r失败:\r\n{1} \r\n", vinsFail[i].Name, vinsFail[i].Value);
                        }
                    }
                    string      summary = string.Format("{0}条申请成功\r\n {1}条申请失败\r\n", vinsSucc.Count, vinsFail.Count);
                    MessageForm mf      = new MessageForm(String.Format("{0}{1} \n{2}", summary, strSucc, strFail));
                    Utils.SetFormMid(mf);
                    mf.Text = "申请修改结果";
                    mf.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (pf != null)
                {
                    pf.Close();
                }
                //Utils.Close("UPDATE");
            }
        }
示例#2
0
        // 撤销
        private void barRepeal_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!Utils.CheckUser())
            {
                return;
            }
            try
            {
                //获取撤销的数据
                List <string> vinList = new List <string>();
                this.dgvCljbxx.DefaultView.PostEditor();
                DataTable dt = (DataTable)this.dgvCljbxx.DataSource;
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        bool result = false;
                        bool.TryParse(dt.Rows[i]["check"].ToString(), out result);
                        if (result)
                        {
                            string vin = (string)dt.Rows[i]["vin"];
                            vinList.Add(vin);
                        }
                    }
                }
                if (vinList == null || vinList.Count < 1)
                {
                    MessageBox.Show("请选择要撤销的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                string     delReason = string.Empty;
                ReasonForm rf        = new ReasonForm();
                Utils.SetFormMid(rf);
                rf.Text = "撤销原因";
                rf.ShowDialog();

                //Utils.Open("DELETE");
                if (rf.DialogResult == DialogResult.OK)
                {
                    pf = new ProcessForm();
                    pf.Show();
                    delReason = rf.Reason;
                    // 撤销
                    List <OperateResult> orList = this.ApplyParamMultiRows(vinList, delReason);

                    // 获取撤销结果
                    List <string>               vinsSucc    = new List <string>();
                    List <NameValuePair>        vinsFail    = new List <NameValuePair>();
                    Dictionary <string, string> dSuccVinVid = new Dictionary <string, string>();
                    Utils.getOperateResultListVins(orList, vinsSucc, vinsFail, dSuccVinVid);

                    string strSucc = "";// "备案号(VIN):返回码(VID)";
                    // 修改本地状态为“3:已撤销”
                    if (vinsSucc.Count > 0)
                    {
                        string strUpdate = "";
                        for (int i = 0; i < vinsSucc.Count; i++)
                        {
                            strUpdate += String.Format(",'{0}'", vinsSucc[i]);
                            strSucc   += String.Format("备案号(VIN):{0},\r反馈码(VID):{1}, \r成功 \r\n", vinsSucc[i], dSuccVinVid[vinsSucc[i]]);
                        }

                        // 删除已撤销数据
                        //Utils.DelVin(strUpdate.Substring(1));
                        DelteLocalData(strUpdate.Substring(1));

                        //Utils.setStatusForUpload(strUpdate.Substring(1), "3");
                        //// 反馈码入库
                        //Utils.setVidForUpload(dSuccVinVid);

                        // 刷新当前页面
                        int pageNum = Convert.ToInt32(txtPage.Text.Substring(0, txtPage.Text.LastIndexOf("/")));
                        this.SearchLocal(pageNum);
                    }
                    string strFail = "";
                    if (vinsFail.Count > 0)
                    {
                        for (int i = 0; i < vinsFail.Count; i++)
                        {
                            strFail += String.Format("备案号(VIN):{0},\r反馈码(VID):, \r失败:{1} \r\n", vinsFail[i].Name, vinsFail[i].Value);
                        }
                    }
                    string      summary = string.Format("{0}条申请成功\r\n {1}条申请失败\r\n", vinsSucc.Count, vinsFail.Count);
                    MessageForm mf      = new MessageForm(String.Format("{0}{1} \n{2}", summary, strSucc, strFail));
                    Utils.SetFormMid(mf);
                    mf.Text = "申请撤销结果";
                    mf.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (pf != null)
                {
                    pf.Close();
                }
                //Utils.Close("DELETE");
            }
        }
示例#3
0
        private void btnUploadOT_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!Utils.CheckUser())
            {
                return;
            }
            try
            {
                //获取补传的数据
                List <string> vinList = new List <string>();
                this.dgvCljbxx.DefaultView.PostEditor();
                DataTable dt = (DataTable)this.dgvCljbxx.DataSource;
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        bool result = false;
                        bool.TryParse(dt.Rows[i]["check"].ToString(), out result);
                        if (result)
                        {
                            string vin = String.Format("'{0}'", dt.Rows[i]["vin"]);
                            vinList.Add(vin);
                        }
                    }
                }
                if (vinList == null || vinList.Count < 1)
                {
                    MessageBox.Show("请选择要补传的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                string     delReason = string.Empty;
                ReasonForm rf        = new ReasonForm();
                Utils.SetFormMid(rf);
                rf.Text = "补传原因";
                rf.ShowDialog();

                //Utils.Open("INSERT_O");

                if (rf.DialogResult == DialogResult.OK)
                {
                    pf = new ProcessForm();
                    pf.Show();

                    // 补传
                    List <OperateResult> orList = this.applyOTParamMultiRows(vinList, rf.Reason);

                    // 获取补传结果
                    List <string>               vinsSucc    = new List <string>();
                    List <NameValuePair>        vinsFail    = new List <NameValuePair>();
                    Dictionary <string, string> dSuccVinVid = new Dictionary <string, string>();
                    Utils.getOperateResultListVins(orList, vinsSucc, vinsFail, dSuccVinVid);

                    string strSucc = "";// "备案号(VIN):返回码(VID)";
                    // 修改本地状态为“4:已申请补传”
                    if (vinsSucc.Count > 0)
                    {
                        string strUpdate = "";
                        for (int i = 0; i < vinsSucc.Count; i++)
                        {
                            strUpdate += String.Format(",'{0}'", vinsSucc[i]);
                            strSucc   += String.Format("备案号(VIN):{0},\r反馈码(VID):{1}, \r成功 \r\n", vinsSucc[i], dSuccVinVid[vinsSucc[i]]);
                        }
                        //Utils.setStatusForUpload(strUpdate.Substring(1), "0");
                        //// 反馈码入库
                        //Utils.setVidForUpload(dSuccVinVid);

                        Utils.setVidStatusForUpload(dSuccVinVid);

                        // 刷新当前页面
                        this.searchLocal();
                    }

                    string strFail = "";
                    if (vinsFail.Count > 0)
                    {
                        for (int i = 0; i < vinsFail.Count; i++)
                        {
                            strFail += String.Format("备案号(VIN):{0},\r反馈码(VID):, \r失败: {1} \r\n", vinsFail[i].Name, vinsFail[i].Value);
                        }
                    }
                    string      summary = string.Format("{0}条补传成功\r\n {1}条补传失败\r\n", vinsSucc.Count, vinsFail.Count);
                    MessageForm mf      = new MessageForm(String.Format("{0}{1} \n{2}", summary, strSucc, strFail));
                    Utils.SetFormMid(mf);
                    mf.Text = "补传结果";
                    mf.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (pf != null)
                {
                    pf.Close();
                }
                //关端口
                //Utils.Close("INSERT_O");
            }
        }