bug
lu
2025-06-12 64a6c4193199d15d7ac5aa67a9677df01a37a50d
DevApp/Gs.DevApp/DevFrm/Work/Frm_WorkStart.cs
@@ -1,35 +1,92 @@
using DevExpress.XtraEditors;
using Gs.DevApp.Entity;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
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;
using System.IO;
namespace Gs.DevApp.DevFrm.Work
{
    public partial class Frm_WorkStart : DevExpress.XtraEditors.XtraForm
    {
        /// <summary>
        /// pc只需要过站
        /// </summary>
        private string isPc = "投入,电检,水检,终检";
        //电检取值路径
        string dianJianPath = "";
        public Frm_WorkStart()
        {
            InitializeComponent();
            _getListJyxm();
            btnLogin.Click += BtnLogin_Click;
        }
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            Frm_Work01 frm = new Frm_Work01();
            if (txt_bc.SelectedIndex <= 0)
            {
                txt_bc.Focus();
                Gs.DevApp.ToolBox.MsgHelper.ShowInformation("请选择班次!");
                return;
            }
            if (txt_gx.SelectedIndex <= 0)
            {
                txt_gx.Focus();
                Gs.DevApp.ToolBox.MsgHelper.ShowInformation("请选择工序!");
                return;
            }
            string fGx = txt_gx.Text.Trim();
            string fBc = txt_bc.Text.Trim();
            //如果是电检
            if (fGx == "G002:电检")
            {
                if (!getConfigDianJian())
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("读取【G002:电检】置文件失败,请联系管理员!");
                    return;
                }
            }
            Frm_Work01 frm = new Frm_Work01(fGx, fBc,dianJianPath);
            frm.ShowDialog();
        }
        /// <summary>
        /// 先读取电检配置
        /// </summary>
        /// <returns></returns>
        private bool getConfigDianJian()
        {
            //这是电检数据的路径
            string _where = " and 1=1 and  defect_code='1008'";
            var pgq = new PageQueryModel(1, 999999, "a.defect_code", "asc", "", _where);
            var json = JsonConvert.SerializeObject(pgq);
            try
            {
                var strReturn = UtilityHelper.HttpPost("", "MesDefectCodeManager/GetListPage", json);
                var dd = UtilityHelper.ReturnToTablePage(strReturn);
                var dt = dd.rtnData.list;
                if (dt != null && dt.Rows.Count > 0)
                {
                    dianJianPath = dt.Rows[0]["defectName"].ToString();
                    if (File.Exists(dianJianPath))
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
                return false;
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
                return false;
            }
        }
        /// <summary>
        /// 读取工序下拉
@@ -46,7 +103,8 @@
                txt_gx.Properties.Items.Add("-请选择-");
                foreach (DataRow dr in dt.Rows)
                {
                    txt_gx.Properties.Items.Add(dr["processNo"].ToString()+":"+ dr["processName"].ToString());
                    if (isPc.Contains(dr["processName"].ToString()))
                        txt_gx.Properties.Items.Add(dr["processNo"].ToString() + ":" + dr["processName"].ToString());
                }
                txt_gx.Focus();
                txt_gx.SelectedIndex = 0;