/// <summary> /// Cancel document /// </summary> protected virtual void Cancel() { if (btnCancel.Visibility == DevExpress.XtraBars.BarItemVisibility.Never || btnCancel.Enabled == false) { return; } this.MessageBox = new MessageBoxs(); IvsMessage message = new IvsMessage(CommonConstantMessage.COM_MSG_CONFIRM_CANCEL); this.MessageBox.Add(message); CommonData.MessageTypeResult result = this.MessageBox.Display(CommonData.MessageType.YesNo); if (result == CommonData.MessageTypeResult.Yes) { //Input cancel reason ReasonForm reasonForm = new ReasonForm(); reasonForm.ShowDialog(); if (reasonForm.MsgTypeResult == CommonData.MessageTypeResult.OK) { ST_StockTransactionMasterDto cancelDto = ((ST_StockTransactionMasterDto)this.Dto); cancelDto.CancelReason = reasonForm.Reason; this.MessageBox = new MessageBoxs(); StockTransactionBl stockTransactionBl = new StockTransactionBl(); StockResult stockResult = stockTransactionBl.Cancel(cancelDto); if (stockResult.ReturnCode == CommonData.StockReturnCode.Succeed) { message = new IvsMessage(CommonConstantMessage.COM_MSG_CANCEL_SUCCESSFULLY); this.MessageBox.Add(message); this.MessageBox.Display(CommonData.MessageType.Ok); this.CloseForm(); } else { lblErrorMessage.Text = ProcessStockException(stockResult); } } } }
// 上报 private FuelDataService.OperateResult applyParam(string uploadType) { try { List <FuelDataModel.VehicleBasicInfo> lbiList = new List <FuelDataModel.VehicleBasicInfo>(); FuelDataModel.VehicleBasicInfo lbi = new FuelDataModel.VehicleBasicInfo(); //VehicleBasicInfo[] lbiList = new VehicleBasicInfo[1] { new VehicleBasicInfo() }; lbi.V_Id = ""; lbi.User_Id = Utils.userId; lbi.Qcscqy = tbqcscqy.Text.Trim(); lbi.Jkqczjxs = this.tbjkqczjxs.Text.Trim(); lbi.Vin = this.tbvin.Text.Trim().ToUpper(); lbi.Hgspbm = this.tbHgspbm.Text.Trim().ToUpper(); lbi.Clxh = this.tbclxh.Text.Trim(); lbi.Clzl = this.tbclzl.Text.Trim(); lbi.Rllx = this.tbrllx.Text.Trim(); lbi.Zczbzl = this.tbzczbzl.Text.Trim(); lbi.Zgcs = this.tbzgcs.Text.Trim(); lbi.Ltgg = this.tbltgg.Text.Trim(); lbi.Zj = this.tbzj.Text.Trim(); lbi.Clzzrq = DateTime.Parse(this.tbclzzrq.Text); lbi.Tymc = this.tbtymc.Text.Trim(); lbi.Yyc = this.tbyyc.Text.Trim(); lbi.Zwps = this.tbzwps.Text.Trim(); lbi.Zdsjzzl = this.tbzdsjzzl.Text.Trim(); lbi.Edzk = this.tbedzk.Text.Trim(); lbi.Lj = this.tblj.Text.Trim(); lbi.Qdxs = this.tbqdxs.Text.Trim(); lbi.Jyjgmc = this.tbjyjgmc.Text.Trim(); lbi.Jybgbh = this.tbjybgbh.Text.Trim(); lbi.Qtxx = this.tbQtxx.Text.Trim(); lbi.CreateTime = DateTime.Now; lbi.UpdateTime = DateTime.Now; List <FuelDataModel.RllxParamEntity> listParam = new List <FuelDataModel.RllxParamEntity>(); foreach (Control c in this.tlp.Controls) { if (c is TextEdit || c is DevExpress.XtraEditors.ComboBoxEdit) { FuelDataModel.RllxParamEntity pe = new FuelDataModel.RllxParamEntity(); string strLabName = "lbl" + c.Name; Control[] lblc = this.Controls.Find(strLabName, true); string paramCode = c.Name; string paramValue = c.Text; //string paramName = lblc[0].Text; pe.V_Id = ""; pe.Param_Code = paramCode; pe.Vin = this.tbvin.Text.Trim(); //pe.Param_Name = paramName; pe.Param_Value = c.Text; listParam.Add(pe); } } lbi.EntityList = listParam.ToArray(); lbiList.Add(lbi); // 上报 if (uploadType == "UPLOADOT") { string delReason = string.Empty; ReasonForm rf = new ReasonForm(); Utils.SetFormMid(rf); rf.Text = "补传原因"; rf.ShowDialog(); if (rf.DialogResult == DialogResult.OK) { foreach (VehicleBasicInfo vInfo in lbiList) { vInfo.Reason = rf.Reason; } return(service.UploadOverTime(Utils.userId, Utils.password, Utils.FuelInfoC2S(lbiList).ToArray(), "CATARC_CUSTOM_2012")); } return(null); } else { return(service.UploadInsertFuelDataList(Utils.userId, Utils.password, Utils.FuelInfoC2S(lbiList).ToArray(), "CATARC_CUSTOM_2012")); } } catch (Exception ex) { throw ex; } }
private void btnUploadOT_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (!Utils.CheckUser()) { return; } try { //获取补传的数据 List <string> vinList = new List <string>(); this.gcCljbxx.DefaultView.PostEditor(); DataTable dt = (DataTable)this.gcCljbxx.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"); } }
// 上报已修改的信息 private void barUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (!Utils.CheckUser()) { return; } try { //获取上报修改的数据 List <string> vinList = new List <string>(); this.gcCljbxx.DefaultView.PostEditor(); DataTable dt = (DataTable)this.gcCljbxx.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"); } }
//撤销 private void barRepeal_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (!Utils.CheckUser()) { return; } try { //获取撤销的数据 List <string> vinList = new List <string>(); this.gcCLJBXX.DefaultView.PostEditor(); DataTable dt = (DataTable)this.gcCLJBXX.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(); if (rf.DialogResult == DialogResult.OK) { pf = new ProcessForm(); pf.Show(); delReason = rf.Reason; // 撤销 List <OperateResult> orList = 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]]); } // 删除已撤销数据 DelteLocalData(strUpdate.Substring(1)); // 刷新当前页面 this.refrashCurrentPage(); } 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(); } } }