| | |
| | | using DevExpress.Office.Utils; |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraGrid.Columns; |
| | | 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 Frm_Work01(string _fGx, string _fBc, string _strinOther, int chkWater = 0) |
| | | { |
| | | InitializeComponent(); |
| | | System.Drawing.Font ft1 = new System.Drawing.Font("宋体", 35F);//大按钮 |
| | | System.Drawing.Font ft2 = new System.Drawing.Font("宋体", 25F);//中按钮 |
| | | System.Drawing.Font ft3 = new System.Drawing.Font("宋体", 15F);//grid |
| | | System.Drawing.Font ft4 = new System.Drawing.Font("宋体", 12F);//head |
| | | System.Drawing.Font ft5 = new System.Drawing.Font("宋体", 12F);//表头 |
| | | //设置字体大小 |
| | | this.btnGood.Appearance.Font = ft1; |
| | | this.btnBad.Appearance.Font = ft1; |
| | | this.simpleButton3.Appearance.Font = ft2; |
| | | this.simpleButton7.Appearance.Font = ft2; |
| | | this.simpleButton5.Appearance.Font = ft2; |
| | | this.simpleButton4.Appearance.Font = ft2; |
| | | this.simpleButton6.Appearance.Font = ft2; |
| | | this.lbSum1.Appearance.Font = ft2; |
| | | this.lbSum2.Appearance.Font = ft2; |
| | | this.lbSum3.Appearance.Font = ft2; |
| | | this.lbSum4.Appearance.Font = ft2; |
| | | this.gvMx1.Appearance.Row.Font = ft3; |
| | | this.gvMx2.Appearance.Row.Font = ft3; |
| | | this.layoutControlItem1.AppearanceItemCaption.Font = ft4; |
| | | this.layoutControlItem2.AppearanceItemCaption.Font = ft4; |
| | | this.layoutControlItem3.AppearanceItemCaption.Font = ft4; |
| | | this.layoutControlItem4.AppearanceItemCaption.Font = ft4; |
| | | this.layoutControlItem5.AppearanceItemCaption.Font = ft4; |
| | | this.layShuiJian.AppearanceItemCaption.Font = ft4; |
| | | this.layoutControlItem7.AppearanceItemCaption.Font = ft4; |
| | | this.layoutControlItem8.AppearanceItemCaption.Font = ft4; |
| | | this.layoutControlItem10.AppearanceItemCaption.Font = ft4; |
| | | this.layoutControlItem11.AppearanceItemCaption.Font = ft4; |
| | | this.layoutControlItem12.AppearanceItemCaption.Font = ft4; |
| | | this.layoutControlItem13.AppearanceItemCaption.Font = ft4; |
| | | this.layoutControlItem14.AppearanceItemCaption.Font = ft4; |
| | | this.layoutControlItem15.AppearanceItemCaption.Font = ft4; |
| | | this.txt_gdbh.Properties.Appearance.Font = ft5; |
| | | this.txt_itemNo.Properties.Appearance.Font = ft5; |
| | | this.txt_itemModel.Properties.Appearance.Font = ft5; |
| | | this.txt_gx.Properties.Appearance.Font = ft5; |
| | | this.txt_bc.Properties.Appearance.Font = ft5; |
| | | this.txt_itemName.Properties.Appearance.Font = ft5; |
| | | this.txt_yjDate.Properties.Appearance.Font = ft5; |
| | | this.txt_collectBy.Properties.Appearance.Font = ft5; |
| | | this.txt_sbNo.Properties.Appearance.Font = ft5; |
| | | this.txt_sjXt.Properties.Appearance.Font = ft5; |
| | | this.txt_sjDate.Properties.Appearance.Font = ft5; |
| | | this.txt_barCode.Properties.Appearance.Font = ft5; |
| | | this.txt_currentBarCode.Properties.Appearance.Font = ft5; |
| | | this.txt_gongWei.Properties.Appearance.Font = ft5; |
| | | this.txt_dianJianPath.Properties.Appearance.Font = ft5; |
| | | try |
| | | { |
| | | string _vanishingSeconds = chkWater.ToString(); |
| | |
| | | this.Text = "工序采集【" + _fGx + " - " + _fBc + "】"; |
| | | label8.Text = _fGx + "数量"; |
| | | addColumn(); |
| | | //追溯码框回车事件 |
| | | txt_barCode.KeyDown += (s, e) => |
| | | { |
| | | if (e.KeyCode == Keys.Enter) |
| | |
| | | addModel(goodTag); |
| | | } |
| | | }; |
| | | //工位回车框事件 |
| | | txt_gongWei.KeyDown += (s, e) => |
| | | { |
| | | if (e.KeyCode == Keys.Enter) |
| | |
| | | { |
| | | if (txt_gongWei.Text.Trim().Length <= 0) |
| | | { |
| | | Toast vm = new Toast(-1, "~请扫工位码~"); |
| | | Toast vm = new Toast(-1, "操作失败@n请先扫描工位码"); |
| | | vm.Show(); |
| | | this.ActiveControl = this.txt_gongWei; |
| | | txt_gongWei.Focus(); |
| | |
| | | } |
| | | } |
| | | }; |
| | | //良品按钮事件 |
| | | btnGood.Click += (s, e) => |
| | | { |
| | | addModel(goodTag); |
| | | }; |
| | | //不良品按钮事件 |
| | | btnBad.Click += (s, e) => |
| | | { |
| | | int idx = tabMx.SelectedTabPageIndex; |
| | | if (idx > 0) |
| | | { |
| | | Toast vm = new Toast(-1, "~已帮你切换到【良品明细】,请重新操作~"); |
| | | Toast vm = new Toast(-1, "请重新操作@n已帮你切换到【良品明细】"); |
| | | vm.Show(); |
| | | tabMx.SelectedTabPageIndex = 0; |
| | | return; |
| | |
| | | var dr = gvMx1.GetFocusedDataRow(); |
| | | if (dr == null || string.IsNullOrEmpty(dr["guid"].ToString())) |
| | | { |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | if (_collectGuid.Length < 30) |
| | | { |
| | | Toast vm = new Toast(-1, "~请先选择追溯码~"); |
| | | Toast vm = new Toast(-1, "操作失败@n请先选择追溯码"); |
| | | vm.Show(); |
| | | return; |
| | | } |
| | |
| | | if (txt_gx.Text.Trim() == fGxTouRu) |
| | | _type = "工序G001:投入不良描述"; |
| | | if (txt_gx.Text.Trim() == fGxDianJian) |
| | | _type = "工序G002:电检不良描述"; |
| | | _type = "工序G002:电检不良描述"; |
| | | if (txt_gx.Text.Trim() == fGxShouJian) |
| | | _type = "工序G003:水检不良描述"; |
| | | if (txt_gx.Text.Trim() == fGxZhongJian) |
| | | _type = "工序G004:终检不良描述"; |
| | | UcDictionarySelect frm = new UcDictionarySelect(_type, " a.s_type='"+ _type + "' and pid<>'00000000-0000-0000-0000-000000000000'", _msg); |
| | | string condition = $" pid<>'00000000-0000-0000-0000-000000000000' " ; |
| | | if(txt_orgId.Text.Trim() == "104554") // 电器 |
| | | { |
| | | condition += $" and a.s_type = '{_type}' "; |
| | | } |
| | | if (txt_orgId.Text.Trim() == "104540") // 魔凡 |
| | | { |
| | | condition += $" and a.s_type = '魔凡{_type}' "; |
| | | } |
| | | |
| | | UcDictionarySelect frm = new UcDictionarySelect(_type, condition, _msg); |
| | | frm.UpdateParent += (ss, ee) => |
| | | { |
| | | System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); |
| | |
| | | string _txt = stringBuilder.ToString(); |
| | | if (string.IsNullOrEmpty(_txt)) |
| | | { |
| | | Toast vm = new Toast(-1, "~当为不良时,请选择不良项目~"); |
| | | Toast vm = new Toast(-1, "操作失败@n请选择不良项目"); |
| | | vm.Show(); |
| | | } |
| | | else |
| | |
| | | /// <param name="_barCode">条码</param> |
| | | /// <param name="_checkResult">结果</param> |
| | | /// <param name="_badDescription">不良描述</param> |
| | | /// <param name="_collectGuid">采集guid,如果是不良,需要collectGuid</param> |
| | | /// <returns></returns> |
| | | private dynamic getObj(string _barCode, string _checkResult, string _badDescription = "", string _collectGuid = "") |
| | | { |
| | |
| | | _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() == fGxDianJian) |
| | | { |
| | | string TM = ""; |
| | | string JD = ""; |
| | | string JY = ""; |
| | | string JN = ""; |
| | | string XL = ""; |
| | | string GV = ""; |
| | | string JD = "";//接地 |
| | | string JY = "";//绝缘 |
| | | string JN = "";//交耐 |
| | | string XL = "";//泄漏 |
| | | string GV = ""; //GV功率 |
| | | string JDV = ""; |
| | | string JYV = ""; |
| | | string JNV = ""; |
| | |
| | | { |
| | | return _obj; |
| | | } |
| | | //把电检数据转为json |
| | | //[{"TiaoMa":"","JiaoNai":{"state":"ok","value":"1800V 0.192mA"},"XieLou":{"state":"ok","value":"235.0V 0.024mA"},"JieDi":{"state":"ok","value":"25.0A 43m次"},"GongLv":{"state":"ok","value":"220.0V 9.96A 2196.0W"}}] |
| | | JArray dsTemp = JArray.Parse(myStr); |
| | | foreach (var ss in dsTemp) //查找某个字段与值 |
| | | foreach (var ss in dsTemp) |
| | | { |
| | | TM = (((JObject)ss)["TiaoMa"] == null) ? "" : ((JObject)ss)["TiaoMa"].ToString(); |
| | | //状态,ng或ok |
| | | JD = (((JObject)ss)["JieDi"] == null) ? "" : ((JObject)ss)["JieDi"]["state"].ToString(); |
| | | JY = (((JObject)ss)["JueYuan"] == null) ? "" : ((JObject)ss)["JueYuan"]["state"].ToString(); |
| | | JN = (((JObject)ss)["JiaoNai"] == null) ? "" : ((JObject)ss)["JiaoNai"]["state"].ToString(); |
| | | XL = (((JObject)ss)["XieLou"] == null) ? "" : ((JObject)ss)["XieLou"]["state"].ToString(); |
| | | GV = (((JObject)ss)["GongLv"] == null) ? "" : ((JObject)ss)["GongLv"]["state"].ToString(); |
| | | //具体的值 |
| | | JDV = (((JObject)ss)["JieDi"] == null) ? "" : ((JObject)ss)["JieDi"]["value"].ToString().Replace(" ", ","); |
| | | JYV = (((JObject)ss)["JueYuan"] == null) ? "" : ((JObject)ss)["JueYuan"]["value"].ToString().Replace(" ", ", "); |
| | | JNV = (((JObject)ss)["JiaoNai"] == null) ? "" : ((JObject)ss)["JiaoNai"]["value"].ToString().Replace(" ", ", "); |
| | |
| | | string GWZT = "";//工位状态 |
| | | string SJJGZ = "";//水检查结果1 |
| | | (strCsl1, strSw1, SJJG, GWZT, SJJGZ) = getShuiJian(); |
| | | _obj.t002 = strCsl1; |
| | | _obj.t003 = strSw1; |
| | | _obj.t004 = strCsl2; |
| | | _obj.t005 = strSw2; |
| | | _obj.t006 = strCsl3; |
| | | _obj.t007 = strSw3; |
| | | _obj.t002 = strCsl1;//出水量1 |
| | | _obj.t003 = strSw1;//水温1 |
| | | _obj.t004 = strCsl2;//出水量2 |
| | | _obj.t005 = strSw2;//水温2 |
| | | _obj.t006 = strCsl3;//出水量3 |
| | | _obj.t007 = strSw3;//水温3 |
| | | _obj.t008 = strCsl4; |
| | | _obj.t009 = strSw4; |
| | | _obj.t010 = strCsl5; |
| | | _obj.t011 = strSw5; |
| | | _obj.t012 = SJJGZ; |
| | | _obj.t013 = GWZT; |
| | | _obj.t012 = SJJGZ;//水检结果似乎不用 |
| | | _obj.t013 = GWZT;//工位状态似乎不用 |
| | | return _obj; |
| | | } |
| | | //终检 |
| | |
| | | { |
| | | if (string.IsNullOrEmpty(_barCode)) |
| | | { |
| | | Toast vm = new Toast(-1, "~请先扫追溯码~"); |
| | | Toast vm = new Toast(-1, "操作失败@n请先扫描追溯码"); |
| | | vm.Show(); |
| | | this.ActiveControl = this.txt_barCode; |
| | | txt_barCode.Focus(); |
| | |
| | | if (!string.IsNullOrEmpty(_msg)) |
| | | { |
| | | // Toast vm = new Toast((goodTag == "√" ? 1 : -1), _msg); 2025-08-20 修改提示外观 |
| | | Toast vm = new Toast(1, _rtn.rtnMsg); |
| | | Toast vm; |
| | | if (_msg.EndsWith(".")) |
| | | vm = new Toast(-1, _rtn.rtnMsg); |
| | | else |
| | | vm = new Toast(1, _rtn.rtnMsg); |
| | | vm.Show(); |
| | | } |
| | | } |