From fad2478c12172e84ffb47ae2b97654108ee8856c Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期四, 28 十一月 2024 14:36:06 +0800
Subject: [PATCH] 车间产线下拉

---
 DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs |   91 ++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 80 insertions(+), 11 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs
index fc3e2b6..1f7d248 100644
--- a/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs
+++ b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs
@@ -1,3 +1,5 @@
+using DevExpress.XtraEditors;
+using DevExpress.XtraGrid.Views.Grid;
 using Gs.DevApp.Entity;
 using Gs.DevApp.ToolBox;
 using Gs.DevApp.UserControl;
@@ -46,10 +48,16 @@
                 Rectangle r = new Rectangle(gridView1.GridControl.Width / 2 - 100, e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5);
                 e.Graphics.DrawString(str, f, Brushes.Gray, r);
             };
+            txt_pba013.EditChanged += (s, e) =>
+            {
+                string workGuid = this.txt_pba013.GetGuid();
+                txt_pba016.getSuppler(workGuid);
+                _getListJybz(workGuid);
+            };
             //閫夋嫨闇�瑕佸叆搴撶殑鏄庣粏
             btnSelect.Click += (s, e) =>
             {
-                if (string.IsNullOrEmpty(this.txt_pba013.Text))
+                if (string.IsNullOrEmpty(this.txt_pba013.GetId()))
                 {
                     Gs.DevApp.ToolBox.MsgHelper.ShowError("璇峰厛閫夋嫨杞﹂棿锛屾墠鑳介�夋嫨浠诲姟鍗曪紒");
                     return;
@@ -85,6 +93,8 @@
                 };
                 frm.ShowDialog();
             };
+
+           
         }
 
         /// <summary>
@@ -242,7 +252,7 @@
         {
             string rowGuid = "", rowName = "";
             (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
-                lbGuid, txt_hNo, gridView1,"hNo");
+                lbGuid, txt_hNo, gridView1, "hNo");
             if (string.IsNullOrEmpty(rowGuid))
             {
                 MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
@@ -325,19 +335,32 @@
         private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
         {
             toolBarMenu1.isSetBtn = false;
-            //if (string.IsNullOrEmpty(txt_account.Text.Trim()))
-            //{
-            //    Gs.DevApp.ToolBox.MsgHelper.Warning("鐧诲綍璐﹀彿涓嶈兘涓虹┖锛�");
-            //    txt_account.Focus();
-            //    return;
-            //}
-            var _sb = new StringBuilder();
+            string workId = txt_pba013.GetId();
+            if (string.IsNullOrEmpty(workId.Trim()))
+            {
+                Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨杞﹂棿锛�");
+                txt_pba013.Focus();
+                return;
+            }
+            string lineId = txt_pba016.GetId();
+            if (string.IsNullOrEmpty(lineId.Trim()))
+            {
+                Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨浜х嚎锛�");
+                txt_pba016.Focus();
+                return;
+            }
+            if (string.IsNullOrEmpty(txt_pba015.Text.Trim()))
+            {
+                Gs.DevApp.ToolBox.MsgHelper.Warning("璁″垝浜烘暟涓嶈兘涓虹┖锛�");
+                txt_pba015.Focus();
+                return;
+            }
             var _obj = new
             {
                 guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //涓诲缓
                 bz = txt_pba009.Text.Trim(),
-                cjId = 1,
-                cxId = 1,
+                cjId = workId,
+                cxId = lineId,
                 jhrs = txt_pba015.Text.Trim(),
                 list = new List<dynamic>(),
             };
@@ -522,5 +545,51 @@
                 }
             }
         }
+
+        private void _getListJybz(string workGuid)
+        {
+            if (string.IsNullOrEmpty(workGuid))
+                return;
+            var _obj = new
+            {
+                guid = workGuid //涓诲缓
+            };
+            var json = JsonConvert.SerializeObject(_obj);
+            try
+            {
+                var strReturn = UtilityHelper.HttpPost("",
+                    "SysDepartmentManager/GetModel", json);
+                var _job = JObject.Parse(strReturn);
+                var array = new JArray();
+                var d = _job["rtnData"]["list"];
+                foreach (var a in d) array.Add(a);
+                var dt = JsonConvert.DeserializeObject<DataTable>(array.ToString());
+                foreach (DataRow dr in dt.Rows)
+                {
+                    rptJYBZ.Items.Add((new CboItemEntity(dr["id"].ToString(), dr["name"].ToString())));
+                }
+            }
+            catch (Exception ex)
+            {
+                MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+            }
+        }
+
+        private void rptJYBZ_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            ComboBoxEdit comboBox = sender as ComboBoxEdit;
+            if (comboBox != null)
+            {
+                GridView myView = (gcMx1.MainView as GridView);
+                int dataIndex = myView.GetDataSourceRowIndex(myView.FocusedRowHandle);
+                CboItemEntity _itm = comboBox.EditValue as CboItemEntity;
+                string _val = _itm.Value.ToString();
+                string _txt = _itm.Text.ToString();
+                gvMx1.CloseEditor();
+                gvMx1.UpdateCurrentRow();
+                gvMx1.SetRowCellValue(dataIndex, "daa015LineName", _txt);
+                gvMx1.SetRowCellValue(dataIndex, "daa015", _val);
+            }
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3