| | |
| | | using DevExpress.XtraLayout.Utils; |
| | | using Gs.DevApp.Entity; |
| | | using Gs.DevApp.ToolBox; |
| | | using Gs.DevApp.UserControl; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using NModbus; |
| | |
| | | { |
| | | public partial class Frm_Work01 : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | string isWater = "0"; |
| | | string hostName = "192.168.60.51"; |
| | | int hostNamePoint = 502; |
| | | string strConn = "Data Source=192.168.1.146;Initial Catalog=GS_MES;User ID=mesUser;Password =qixi1qaz@WSXmes"; |
| | |
| | | public Frm_Work01(string _fGx, string _fBc, string _strinOther) |
| | | { |
| | | InitializeComponent(); |
| | | try |
| | | { |
| | | string _vanishingSeconds = ConfigurationManager.AppSettings["IsWater"]; |
| | | if (!string.IsNullOrEmpty(_vanishingSeconds)) |
| | | isWater = _vanishingSeconds; |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | } |
| | | gvMx1.IndicatorWidth = 60; |
| | | gvMx1.CustomDrawRowIndicator += (s, e) => |
| | | { |
| | |
| | | if (e.KeyCode == Keys.Enter) |
| | | { |
| | | //如果是水检,还要扫工位 |
| | | if (txt_gx.Text.Trim() == fGxShouJian) |
| | | if (txt_gx.Text.Trim() == fGxShouJian && isWater == "1") |
| | | { |
| | | txt_gongWei.Focus(); |
| | | } |
| | |
| | | }; |
| | | btnBad.Click += (s, e) => |
| | | { |
| | | string _barCode = txt_barCode.Text.Trim(); |
| | | if (string.IsNullOrEmpty(_barCode)) |
| | | string _collectGuid = lbCollectGuid.Text.Trim(); |
| | | if (_collectGuid.Length < 30) |
| | | { |
| | | Toast vm = new Toast(-1, "~请先扫追溯码~"); |
| | | Toast vm = new Toast(-1, "~请先选择追溯码~"); |
| | | vm.Show(); |
| | | return; |
| | | } |
| | | UcDictionarySelect frm = new UcDictionarySelect("工序不良描述", " a.s_type='工序不良描述' and pid<>'00000000-0000-0000-0000-000000000000'"); |
| | | string _msg = "你准备将【" + txt_gdbh.Text + "】【" + txt_currentBarCode.Text.Trim() + "】变更为不良"; |
| | | UcDictionarySelect frm = new UcDictionarySelect("工序不良描述", " a.s_type='工序不良描述' and pid<>'00000000-0000-0000-0000-000000000000'", _msg); |
| | | frm.UpdateParent += (ss, ee) => |
| | | { |
| | | System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); |
| | |
| | | foreach (dynamic dym in lst) |
| | | { |
| | | if (stringBuilder.Length > 0) |
| | | stringBuilder.Append("|"); |
| | | stringBuilder.Append("&"); |
| | | stringBuilder.Append(dym.dicTxt); |
| | | } |
| | | string _txt = stringBuilder.ToString(); |
| | |
| | | vm.Show(); |
| | | } |
| | | else |
| | | addModel(badTag, _txt); |
| | | addModel(badTag, _txt, lbCollectGuid.Text.Trim()); |
| | | }; |
| | | frm.ShowDialog(); |
| | | }; |
| | | this.ActiveControl = this.txt_barCode; |
| | | txt_barCode.Focus(); |
| | | gvMx1.FocusedRowChanged += (s, e) => |
| | | { |
| | | if (e.FocusedRowHandle >= 0) |
| | | { |
| | | DataRow row = gvMx1.GetDataRow(e.FocusedRowHandle); |
| | | txt_gdbh.Text = row["gdbh"].ToString(); |
| | | txt_currentBarCode.Text = row["barCode"].ToString(); |
| | | lbCollectGuid.Text = row["guid"].ToString(); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="_checkResult">结果</param> |
| | | /// <param name="_badDescription">不良描述</param> |
| | | /// <returns></returns> |
| | | private dynamic getObj(string _barCode, string _checkResult, string _badDescription = "") |
| | | private dynamic getObj(string _barCode, string _checkResult, string _badDescription = "", string _collectGuid = "") |
| | | { |
| | | dynamic _obj = new ExpandoObject(); |
| | | _obj.barCode = _barCode; |
| | |
| | | _obj.banCi = txt_bc.Text.Trim();//班次 |
| | | _obj.gongWei = txt_gongWei.Text.Trim();//工位 |
| | | _obj.badDescription = _badDescription.Trim();//不良描述 |
| | | _obj.collectGuid = _collectGuid; |
| | | if (!string.IsNullOrEmpty(_collectGuid)) |
| | | { |
| | | return _obj; |
| | | } |
| | | if (txt_gx.Text.Trim() == fGxTouRu) |
| | | { |
| | | return _obj; |
| | |
| | | //水检 |
| | | if (txt_gx.Text.Trim() == fGxShouJian) |
| | | { |
| | | if (isWater == "0") |
| | | { |
| | | return _obj; |
| | | } |
| | | string strCsl1 = "";//模式1出水量 |
| | | string strSw1 = "";//模式1水温 |
| | | string strCsl2 = ""; |
| | |
| | | /// </summary> |
| | | /// <param name="_checkResult">结果:√</param> |
| | | /// <param name="_badDescription">不良描述</param> |
| | | private void addModel(string _checkResult, string _badDescription = "") |
| | | private void addModel(string _checkResult, string _badDescription = "", string _collectGuid = "") |
| | | { |
| | | string _barCode = txt_barCode.Text.Trim(); |
| | | if (string.IsNullOrEmpty(_barCode)) |
| | | if (string.IsNullOrEmpty(_collectGuid)) |
| | | { |
| | | Toast vm = new Toast(-1, "~请先扫追溯码~"); |
| | | vm.Show(); |
| | | this.ActiveControl = this.txt_barCode; |
| | | txt_barCode.Focus(); |
| | | return; |
| | | if (string.IsNullOrEmpty(_barCode)) |
| | | { |
| | | Toast vm = new Toast(-1, "~请先扫追溯码~"); |
| | | vm.Show(); |
| | | this.ActiveControl = this.txt_barCode; |
| | | txt_barCode.Focus(); |
| | | return; |
| | | } |
| | | } |
| | | dynamic _obj = getObj(_barCode, _checkResult, _badDescription); |
| | | dynamic _obj = getObj(_barCode, _checkResult, _badDescription, _collectGuid); |
| | | try |
| | | { |
| | | string strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj)); |
| | |
| | | else |
| | | layDianJian.Visibility = LayoutVisibility.Never; |
| | | //只有水检才显示 |
| | | if (txt_gx.Text.Trim() == fGxShouJian) |
| | | if (txt_gx.Text.Trim() == fGxShouJian && isWater == "1") |
| | | layShuiJian.Visibility = LayoutVisibility.Always; |
| | | else |
| | | layShuiJian.Visibility = LayoutVisibility.Never; |