From cb828d0bb553dd6e9ac386d7f7f71b611820c311 Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期五, 20 十二月 2024 15:37:14 +0800
Subject: [PATCH] 工单排产

---
 DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs |  130 ++++++++++++++++++++++++------------------
 1 files changed, 74 insertions(+), 56 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs
index 6b97c13..acc6d88 100644
--- a/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs
+++ b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs
@@ -3,14 +3,11 @@
 using Gs.DevApp.Entity;
 using Gs.DevApp.ToolBox;
 using Gs.DevApp.UserControl;
-using MES.Service.Modes;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using System;
 using System.Collections.Generic;
 using System.Data;
-using System.Drawing;
-using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 
@@ -32,15 +29,23 @@
             this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
             toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
             toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
-            
-            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1);
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
+            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "fstatus", "", (value) =>
+            {
+                Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
+            });
+            Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
+            {
+                getModel(value);
+            }, (value) =>
+            {
+                getPageList(this.pageBar1.CurrentPage);
+            });
             getPageList(1);
             pageBar1.PagerEvent += PageBar1_PagerEvent;
             txt_pba013.EditChanged += (s, e) =>
             {
                 string workGuid = this.txt_pba013.GetGuid();
-                txt_pba016.getSuppler(workGuid);
                 _getListJybz(workGuid);
             };
             //閫夋嫨闇�瑕佸叆搴撶殑鏄庣粏
@@ -89,17 +94,7 @@
            Task.Delay(100);
             getPageList(1);
         }
-        /// <summary>
-        /// 鍙屽嚮浜嬩欢
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void GcMain_MouseDoubleClick(object sender, MouseEventArgs e)
-        {
-            string rowGuid = Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(gridView1, e, "guid");
-            if (!string.IsNullOrEmpty(rowGuid))
-                getModel(rowGuid, false, 999);
-        }
+      
         /// <summary>
         /// 鍒嗛〉浜嬩欢
         /// </summary>
@@ -168,7 +163,7 @@
                 if (_rtn.rtnCode > 0)
                 {
                     if (xtraTabControl1.SelectedTabPageIndex == 1)
-                        getModel(lbGuid.Text.Trim(), false, 999);
+                        getModel(lbGuid.Text.Trim());
                     else
                         getPageList(1);
                 }
@@ -213,7 +208,7 @@
                 if (_rtn.rtnCode > 0)
                 {
                     if (xtraTabControl1.SelectedTabPageIndex == 1)
-                        getModel(lbGuid.Text.Trim(), false, 999);
+                        getModel(lbGuid.Text.Trim());
                     else
                         getPageList(1);
                 }
@@ -269,8 +264,10 @@
                 var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                 if (_rtn.rtnCode > 0)
                 {
-                    UtilityHelper.JumpToTab(xtraTabControl1, 0);
-                    getPageList(1);
+                    if (xtraTabControl1.SelectedTabPageIndex == 0)
+                        getPageList(this.pageBar1.CurrentPage);
+                    else
+                        Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2);
                 }
 
                 MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
@@ -289,7 +286,7 @@
         private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
         {
             if (xtraTabControl1.SelectedTabPageIndex == 1)
-                getModel(lbGuid.Text.Trim(), false, 999);
+                getModel(lbGuid.Text.Trim());
             else
             {
                 _filterList.Clear();
@@ -316,7 +313,10 @@
                 ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
-            getModel(rowGuid, true, 1);
+            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
+            List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
+            gvList.Add(gvMx1);
+            UtilityHelper.ChangeEnableByControl(panel1.Controls, true);
         }
         /// <summary>
         /// 鏂板浜嬩欢
@@ -325,11 +325,9 @@
         /// <param name="e"></param>
         private void ToolBarMenu1_btnAddClick(object sender, EventArgs e)
         {
-            UtilityHelper.JumpToTab(xtraTabControl1, 1);
             lbGuid.Text = "";
-            List<DevExpress.XtraGrid.Views.Grid.GridView> gridViews = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
-            gridViews.Add(gvMx1);
-            UtilityHelper.CleanValueByControl(this.panel1.Controls, true, gridViews);
+            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4);
+            UtilityHelper.CleanValueByControl(panel1.Controls, true);
             Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
         }
         /// <summary>
@@ -347,26 +345,11 @@
                 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 = workId,
-                cxId = lineId,
-                jhrs = txt_pba015.Text.Trim(),
                 list = new List<dynamic>(),
             };
             gvMx1.CloseEditor();
@@ -382,35 +365,66 @@
                 if (row != null)
                 {
                     Guid? _guid = UtilityHelper.ToGuid(row["guid"].ToString());
-                    string _LineId = row["daa015"].ToString();
-                    if (string.IsNullOrEmpty(_LineId))
-                    {
-                        MsgHelper.ShowError("浜х嚎涓嶈兘涓虹┖锛�");
-                        return;
-                    }
+                    //string _LineId = row["daa015"].ToString();
+                    //if (string.IsNullOrEmpty(_LineId))
+                    //{
+                    //    MsgHelper.ShowError("浜х嚎缂栫爜涓嶈兘涓虹┖锛�");
+                    //    return;
+                    //}
                     string _Pcsl = row["daa008"].ToString();
-                    if (string.IsNullOrEmpty(_LineId))
+                    if (string.IsNullOrEmpty(_Pcsl))
                     {
                         MsgHelper.ShowError("鎺掍骇鏁伴噺涓嶈兘涓虹┖锛�");
                         return;
                     }
                     string _Yjkgsj = row["mesStartProd"].ToString();
-                    if (string.IsNullOrEmpty(_LineId))
+                    if (string.IsNullOrEmpty(_Yjkgsj))
                     {
                         MsgHelper.ShowError("棰勮寮�宸ユ椂闂翠笉鑳戒负绌猴紒");
                         return;
                     }
+                    //string _prepareTime = row["prepareTime"].ToString();
+                    //if (string.IsNullOrEmpty(_prepareTime))
+                    //{
+                    //    MsgHelper.ShowError("棰勮澶囨枡鏃堕棿涓嶈兘涓虹┖锛�");
+                    //    return;
+                    //}
+                    //string _planPersonnel = row["planPersonnel"].ToString();
+                    //if (string.IsNullOrEmpty(_planPersonnel))
+                    //{
+                    //    MsgHelper.ShowError("璁″垝浜烘暟锛�");
+                    //    return;
+                    //}
+                    //string _changeLinetime = row["changeLinetime"].ToString();
+                    //if (string.IsNullOrEmpty(_changeLinetime))
+                    //{
+                    //    MsgHelper.ShowError("鎹㈢嚎鏃堕棿涓嶈兘涓虹┖锛�");
+                    //    return;
+                    //}
+                    string _mesEndProd = row["mesEndProd"].ToString();
+                    if (string.IsNullOrEmpty(_mesEndProd))
+                    {
+                        MsgHelper.ShowError("棰勮瀹屽伐鏃堕棿涓嶈兘涓虹┖锛�");
+                        return;
+                    }
+                    //string _restTime = row["restTime"].ToString();
+                    //if (string.IsNullOrEmpty(_prepareTime))
+                    //{
+                    //    MsgHelper.ShowError("浼戞伅鏃堕棿涓嶈兘涓虹┖锛�");
+                    //    return;
+                    //}
                     _obj.list.Add(new
                     {
                         Guid = _guid,
                         AboutGuid = Gs.DevApp.ToolBox.UtilityHelper.ToGuid(row["caaGuid"].ToString()),
-                        LineId = int.Parse(row["daa015"].ToString()),//浜х嚎id
+                        LineId = row["daa015"].ToString(),//浜х嚎id
                         Yjkgsj = (row["mesStartProd"].ToString()),//棰勮寮�宸ユ椂闂�
                         Jhrs = row["planPersonnel"].ToString(),//璁″垝浜烘暟
                         Hxsj = row["changeLinetime"].ToString(),//鎹㈢嚎鏃堕棿
                         Bz = row["daa009"].ToString(),//澶囨敞
                         Blsj = row["prepareTime"].ToString(),//棰勮澶囨枡鏃堕棿
-                        Pcsl = row["daa008"].ToString()//鎺掍骇鏁伴噺
+                        Pcsl = row["daa008"].ToString(),//鎺掍骇鏁伴噺
+                        Yjwgsj = row["mesEndProd"].ToString()//棰勮瀹屽伐鏃堕棿
                     });
                 }
             }
@@ -439,7 +453,6 @@
         /// <param name="pageSize">姣忛〉鍑犳潯</param>
         private   void getPageList(int curPage)
         {
-            
             var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
             PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "create_date", "asc", "", _sbSqlWhere.ToString());
             string json = JsonConvert.SerializeObject(pgq);
@@ -476,14 +489,19 @@
             }
             
         }
-        private void getModel(string strGuid, bool isEdit, int tabIdx)
+        private void getModel(string strGuid)
         {
+            bool isEdit = false;
+            if (toolBarMenu1.currentAction == "add") {
+                Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
+                return;
+            };
+            if (toolBarMenu1.currentAction == "edit") isEdit = true;
             if (string.IsNullOrEmpty(strGuid))
             {
                 ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
-            UtilityHelper.JumpToTab(xtraTabControl1, tabIdx);
             var _obj = new
             {
                 guid = strGuid,//涓诲缓
@@ -555,7 +573,7 @@
                     var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                     if (_rtn.rtnCode > 0)
                     {
-                        if (_rtn.rtnCode > 0) getModel(lbGuid.Text, true, 1);
+                        if (_rtn.rtnCode > 0) getModel(lbGuid.Text);
                     }
                     MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
                 }

--
Gitblit v1.9.3