lu
2025-04-14 ecb7a60de1639f520712ce95f99414b0dd2c9713
DevApp/Gs.DevApp/UserControl/UcLookDaa.cs
@@ -1,31 +1,24 @@
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;
namespace Gs.DevApp.UserControl
{
    public partial class UcLookDaa : DevExpress.XtraEditors.XtraUserControl
    {
        public UcLookDaa()
        {
            InitializeComponent();
            lookSearchSupplier.Properties.NullText = "请选择";
            lookSearchSupplier.EditValueChanged +=
                LookSearchSupplier_EditValueChanged;
            getSuppler();
            // getSuppler();
        }
        public bool IsReadly { get; set; }
        private bool _rdy; public bool IsReadly { set { _rdy = value; this.lookSearchSupplier.ReadOnly = _rdy; } get { return _rdy; } }
        /// <summary>
        ///     改变事件
@@ -37,10 +30,18 @@
        {
            if (EditChanged != null) EditChanged(this, e);
        }
        private void getSuppler()
        /// <summary>
        /// 读取工单
        /// </summary>
        /// <param name="orgId"></param>
        public void getSuppler(string orgId, string _dftVale = "")
        {
            var pgq = new PageQueryModel(1, 999999, "a.daa001", "asc", "", " and 1=1");
            lookSearchSupplier.EditValue = null;
            string _keyWhere = "";
            if (!string.IsNullOrEmpty(orgId))
                _keyWhere = " and a.erp_sczz ='" + orgId + "'";
            var pgq = new PageQueryModel(1, 999999, "a.daa001", "asc", "",
                " and 1=1" + _keyWhere);
            var json = JsonConvert.SerializeObject(pgq);
            try
            {
@@ -50,13 +51,20 @@
                lookSearchSupplier.Properties.DataSource = dt;
                lookSearchSupplier.Properties.DisplayMember = "daa001";
                lookSearchSupplier.Properties.ValueMember = "guid";
                lookSearchSupplier.ForceInitialize();
                lookSearchSupplier.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
                if (!string.IsNullOrEmpty(_dftVale))
                    SetIdOrCode(_dftVale);
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// 工单guid
        /// </summary>
        /// <returns></returns>
        public string GetId()
        {
            var row = lookSearchSupplier.GetSelectedDataRow() as DataRowView;
@@ -67,6 +75,10 @@
            }
            return "";
        }
        /// <summary>
        /// 工单编号
        /// </summary>
        /// <returns></returns>
        public string GetCode()
        {
            var row = lookSearchSupplier.GetSelectedDataRow() as DataRowView;
@@ -77,12 +89,19 @@
            }
            return "";
        }
        /// <summary>
        /// 工单文本,应该是编号
        /// </summary>
        /// <returns></returns>
        public string GetName()
        {
            var name = lookSearchSupplier.Text.Trim();
            return name;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="Code"></param>
        public void SetIdOrCode(string Code)
        {
            if (Code == "-1")
@@ -92,6 +111,132 @@
            }
            lookSearchSupplier.EditValue = (((Code.ToString().Trim())));
        }
        /// <summary>
        /// 产品id
        /// </summary>
        /// <returns></returns>
        public string GetPrdId()
        {
            var row = lookSearchSupplier.GetSelectedDataRow() as DataRowView;
            if (row != null)
            {
                string id = row["daa002"].ToString();
                return id;
            }
            return "";
        }
        /// <summary>
        /// 产品名称
        /// </summary>
        /// <returns></returns>
        public string GetPrdName()
        {
            var row = lookSearchSupplier.GetSelectedDataRow() as DataRowView;
            if (row != null)
            {
                string id = row["itemName"].ToString();
                return id;
            }
            return "";
        }
        /// <summary>
        /// 产品规格型号
        /// </summary>
        /// <returns></returns>
        public string GetPrdModel()
        {
            var row = lookSearchSupplier.GetSelectedDataRow() as DataRowView;
            if (row != null)
            {
                string id = row["itemModel"].ToString();
                return id;
            }
            return "";
        }
        /// <summary>
        /// 产品编码
        /// </summary>
        /// <returns></returns>
        public string GetPrdNo()
        {
            var row = lookSearchSupplier.GetSelectedDataRow() as DataRowView;
            if (row != null)
            {
                string id = row["itemNo"].ToString();
                return id;
            }
            return "";
        }
        /// <summary>
        /// 车间
        /// </summary>
        /// <returns></returns>
        public string GetWorkName()
        {
            var row = lookSearchSupplier.GetSelectedDataRow() as DataRowView;
            if (row != null)
            {
                string id = row["dptnName"].ToString();
                return id;
            }
            return "";
        }
        /// <summary>
        /// 线别
        /// </summary>
        /// <returns></returns>
        public string GetWorkXb()
        {
            var row = lookSearchSupplier.GetSelectedDataRow() as DataRowView;
            if (row != null)
            {
                string id = row["xb"].ToString();
                return id;
            }
            return "";
        }
        /// <summary>
        /// 任务单号
        /// </summary>
        /// <returns></returns>
        public string GetRwd()
        {
            var row = lookSearchSupplier.GetSelectedDataRow() as DataRowView;
            if (row != null)
            {
                string id = row["daa021"].ToString();
                return id;
            }
            return "";
        }
        /// <summary>
        /// 投料单号
        /// </summary>
        /// <returns></returns>
        public string GetTldh()
        {
            var row = lookSearchSupplier.GetSelectedDataRow() as DataRowView;
            if (row != null)
            {
                string id = row["daa014"].ToString();
                return id;
            }
            return "";
        }
        /// <summary>
        /// 类型,多用于分类查询
        /// </summary>
        public string category
        {
            set;
            get;
        }
    }
}