| | |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.Utils.DirectXPaint; |
| | | using DevExpress.XtraBars.Alerter; |
| | | using DevExpress.XtraEditors; |
| | | using Gs.DevApp.Entity; |
| | | using Gs.DevApp.ToolBox; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | |
| | | { |
| | | public partial class Frm_Work01 : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | string _webServiceName = "WorkCollect/"; |
| | | public Frm_Work01() |
| | | { |
| | | InitializeComponent(); |
| | | |
| | | txt_barCode.KeyDown += (s, e) => |
| | | { |
| | | if (e.KeyCode == Keys.Enter) { getModel(); }; |
| | | }; |
| | | } |
| | | |
| | | private void getModel() |
| | | { |
| | | string _barCode =txt_barCode.Text.Trim(); |
| | | //string _guid = ""; |
| | | string _inBz = ""; ; //备注 |
| | | string _checkVal = ""; ; //检测值 |
| | | string _checkResult = ""; ; //检测结果 |
| | | if (string.IsNullOrEmpty(_barCode)) |
| | | { |
| | | ToolBox.MsgHelper.ShowError("请先扫码!"); |
| | | return; |
| | | } |
| | | var _obj = new |
| | | { |
| | | // guid = _guid, |
| | | barCode = _barCode, |
| | | inBz = _inBz, |
| | | checkVal = _checkVal, |
| | | checkResult = _checkResult, |
| | | }; |
| | | try |
| | | { |
| | | string strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | dynamic dy = _rtn.rtnData; |
| | | JObject _job = JObject.Parse(strJson); |
| | | JArray array = new JArray(); |
| | | foreach (var a in _job["rtnData"]["list"]) |
| | | { |
| | | array.Add(a); |
| | | } |
| | | DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString()); |
| | | if (dt.Rows.Count > 0) |
| | | { |
| | | gcMx1.BindingContext = new BindingContext(); |
| | | gcMx1.DataSource = dt; |
| | | gcMx1.ForceInitialize(); |
| | | gvMx1.BestFitColumns(); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1); |
| | | } |
| | | else |
| | | { |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); |
| | | } |
| | | JArray array2 = new JArray(); |
| | | foreach (var a in _job["rtnData"]["list2"]) |
| | | { |
| | | array2.Add(a); |
| | | } |
| | | DataTable dt2 = JsonConvert.DeserializeObject<DataTable>(array2.ToString()); |
| | | if (dt2.Rows.Count > 0) |
| | | { |
| | | gcMx2.BindingContext = new BindingContext(); |
| | | gcMx2.DataSource = dt2; |
| | | gcMx2.ForceInitialize(); |
| | | gvMx2.BestFitColumns(); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx2); |
| | | } |
| | | else |
| | | { |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx2, gvMx2); |
| | | } |
| | | string _msg = _rtn.rtnMsg; |
| | | //设置单窗口出现弹出的速度 |
| | | this.alertControl1.FormDisplaySpeed = DevExpress.XtraBars.Alerter.AlertFormDisplaySpeed.Fast; |
| | | //设置显示多少时间窗口会自动关闭 以毫秒为单位 |
| | | this.alertControl1.AutoFormDelay = 3000; |
| | | //设置提出窗口的显示的位置 |
| | | this.alertControl1.FormLocation = DevExpress.XtraBars.Alerter.AlertFormLocation.BottomRight; |
| | | this.alertControl1.Show(this, "提示!", _msg); |
| | | |
| | | } |
| | | else |
| | | ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |