lu
2025-09-24 891658c2e6640d8c7631b9c892722ccc1eeaa31b
DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs
@@ -1,10 +1,8 @@
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;
@@ -26,7 +24,7 @@
        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";
        string strConn = "Data Source=192.168.1.146,12468;Initial Catalog=GS_MES;User ID=mesUser;Password =qixi1qaz@WSXmes";
        bool isCleanDianJian = true;
        string _webServiceName = "WorkCollect/";
        string dianJianPath = "";//电检取值路径
@@ -43,12 +41,61 @@
        /// <param name="_fGx">工序</param>
        /// <param name="_fBc">班次</param>
        /// <param name="_strinOther">目前为电检路径</param>
        public Frm_Work01(string _fGx, string _fBc, string _strinOther)
        /// <param name="chkWater">是否水检</param>
        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 = ConfigurationManager.AppSettings["IsWater"];
                string _vanishingSeconds = chkWater.ToString();
                if (!string.IsNullOrEmpty(_vanishingSeconds))
                    isWater = _vanishingSeconds;
            }
@@ -107,15 +154,43 @@
            };
            btnBad.Click += (s, e) =>
            {
                string _collectGuid = lbCollectGuid.Text.Trim();
                int idx = tabMx.SelectedTabPageIndex;
                if (idx > 0)
                {
                    Toast vm = new Toast(-1, "~已帮你切换到【良品明细】,请重新操作~");
                    vm.Show();
                    tabMx.SelectedTabPageIndex = 0;
                    return;
                }
                string _collectGuid = "";
                string _collCode = "";
                var dr = gvMx1.GetFocusedDataRow();
                if (dr == null || string.IsNullOrEmpty(dr["guid"].ToString()))
                {
                }
                else
                {
                    _collectGuid = dr["guid"].ToString();
                    _collCode = dr["barCode"].ToString();
                }
                if (_collectGuid.Length < 30)
                {
                    Toast vm = new Toast(-1, "~请先选择追溯码~");
                    vm.Show();
                    return;
                }
                string _msg = "你准备将【" + txt_gdbh.Text + "】【" + txt_currentBarCode.Text.Trim() + "】变更为不良";
                UcDictionarySelect frm = new UcDictionarySelect("工序不良描述", " a.s_type='工序不良描述' and pid<>'00000000-0000-0000-0000-000000000000'", _msg);
                string _msg = "你准备将【" + _collCode + "】变更为不良";
                string _type = "";
                if (txt_gx.Text.Trim() == fGxTouRu)
                    _type = "工序G001:投入不良描述";
                if (txt_gx.Text.Trim() == fGxDianJian)
                    _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);
                frm.UpdateParent += (ss, ee) =>
                {
                    System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
@@ -133,22 +208,14 @@
                        vm.Show();
                    }
                    else
                        addModel(badTag, _txt, lbCollectGuid.Text.Trim());
                        addModel(badTag, _txt, _collectGuid);
                };
                frm.ShowDialog();
                this.ActiveControl = this.txt_barCode;
                txt_barCode.Focus();
            };
            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>
@@ -419,25 +486,25 @@
                {
                    ziduan = "t007",
                    wenben = "接地结果",
                    visibleIndex = -1,
                    visibleIndex = 1,
                });
                _lst.Add(new
                {
                    ziduan = "t009",
                    wenben = "交耐结果",
                    visibleIndex = -1,
                    visibleIndex = 1,
                });
                _lst.Add(new
                {
                    ziduan = "t010",
                    wenben = "泄漏结果",
                    visibleIndex = -1,
                    visibleIndex = 1,
                });
                _lst.Add(new
                {
                    ziduan = "t011",
                    wenben = "功率结果",
                    visibleIndex = -1,
                    visibleIndex = 1,
                });
            }
            if (txt_gx.Text.Trim() == fGxShouJian)