lu
2024-12-20 cb828d0bb553dd6e9ac386d7f7f71b611820c311
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);
                }