| | |
| | | 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; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | |
| | | namespace Gs.DevApp.DevFrm.Work |
| | | { |
| | | public partial class Frm_Work01 : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | public Frm_Work01() |
| | | string _webServiceName = "WorkCollect/"; |
| | | string fGx = ""; |
| | | string fBc = ""; |
| | | public Frm_Work01(string _fGx, string _fBc) |
| | | { |
| | | InitializeComponent(); |
| | | this.Text = "工序采集 - " + _fGx+ " - "+ fBc; |
| | | this.fGx = _fGx; |
| | | this.fBc = _fBc; |
| | | txt_gx.Text = fGx; |
| | | txt_bc.Text = fBc; |
| | | txt_barCode.KeyDown += (s, e) => |
| | | { |
| | | if (e.KeyCode == Keys.Enter) { getModel("", "√"); }; |
| | | }; |
| | | btnGood.Click += (s, e) => |
| | | { |
| | | getModel("", "√"); |
| | | }; |
| | | btnBad.Click += (s, e) => { |
| | | getModel("", "×"); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="_checkVal">检测值</param> |
| | | /// <param name="_checkResult">检测结果</param> |
| | | private void getModel(string _checkVal, string _checkResult) |
| | | { |
| | | string _barCode = txt_barCode.Text.Trim(); |
| | | string _inBz = ""; ; //备注 |
| | | if (string.IsNullOrEmpty(_barCode)) |
| | | { |
| | | ToolBox.MsgHelper.ShowError("请先扫码!"); |
| | | return; |
| | | } |
| | | var _obj = new |
| | | { |
| | | barCode = _barCode, |
| | | inBz = _inBz, |
| | | checkVal = _checkVal, |
| | | checkResult = _checkResult, |
| | | processNo = txt_gx.Text.Trim(),//工序 |
| | | banCi = txt_bc.Text.Trim(),//班次 |
| | | gongWei = txt_gw.Text.Trim(),//工位 |
| | | }; |
| | | 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; |
| | | UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, false); |
| | | lbSum1.Text = dy.lbSum1; |
| | | lbSum2.Text = dy.lbSum2; |
| | | lbSum3.Text = dy.lbSum3; |
| | | lbSum4.Text = dy.lbSum4; |
| | | prog1.Position = dy.jd; |
| | | txt_barCode.ReadOnly = false; |
| | | 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; |
| | | if (!string.IsNullOrEmpty(_msg)) |
| | | { |
| | | //设置单窗口出现弹出的速度 |
| | | this.alertControl1.FormDisplaySpeed = DevExpress.XtraBars.Alerter.AlertFormDisplaySpeed.Fast; |
| | | //设置显示多少时间窗口会自动关闭 以毫秒为单位 |
| | | this.alertControl1.AutoFormDelay = 3000; |
| | | //设置提出窗口的显示的位置 |
| | | this.alertControl1.FormLocation = DevExpress.XtraBars.Alerter.AlertFormLocation.BottomLeft; |
| | | this.alertControl1.Show(this, "提示!", _msg); |
| | | }; |
| | | } |
| | | else |
| | | ToolBox.MsgHelper.ShowError("提示:" + _rtn.rtnMsg); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ToolBox.MsgHelper.ShowError("提示:" + ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |