lu
2025-03-31 37d32d9263f757072a6ff348ae5e99824fab4ef9
DevApp/Gs.DevApp/DevFrm/Work/Frm_WorkTechnique.cs
@@ -1,6 +1,4 @@
using DevExpress.Utils.MVVM.Services;
using DevExpress.XtraPivotGrid.Data;
using DevExpress.XtraPrinting.Native;

using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Gs.DevApp.UserControl;
@@ -11,6 +9,7 @@
using System.Data;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Gs.DevApp.DevFrm.Work
{
@@ -60,7 +59,7 @@
                        foreach (dynamic dym in lst)
                        {
                            DataRow _row = _Table.NewRow();
                            _row["fSeq"] = "001";
                            _row["fSeq"] = dym.fSeq;
                            _row["statStatus"] = "Y-是";
                            _row["collectionName"] = "空";
                            _row["processNo"] = dym.processNo;
@@ -82,6 +81,7 @@
                };
                frm.ShowDialog();
            };
            _getListJyxm();
        }
        private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
@@ -233,6 +233,48 @@
        private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
        {
            toolBarMenu1.isSetBtn = false;
            if (txt_fType.SelectedIndex <= 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowInformation("生产类型不能为空!");
                txt_fType.Focus();
                return;
            }
            if (txt_fJingDu.SelectedIndex < 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowInformation("管理精度不能为空!");
                txt_fJingDu.Focus(); return;
            }
            if (txt_fBegDate.Text.Length <= 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowInformation("生效日期不能为空!");
                txt_fBegDate.Focus(); return;
            }
            if (txt_fEndDate.Text.Length > 0 && txt_fBegDate.DateTime > txt_fEndDate.DateTime)
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowInformation("生效日期不能大于失效日期!");
                txt_fEndDate.Focus(); return;
            }
            decimal num = 0;
            int num2 = 0;
            if (!int.TryParse(txt_fSumPeople.Text.Trim(), out num2)) {
                Gs.DevApp.ToolBox.MsgHelper.ShowInformation("请输入正确的定员!");
                txt_fSumPeople.Focus(); return;
            }
            if (!decimal.TryParse(txt_fCapacity.Text.Trim(), out num))
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowInformation("请输入正确的产能!");
                txt_fCapacity.Focus(); return;
            }
            if (!decimal.TryParse(txt_fMaxWeight.Text.Trim(), out num))
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowInformation("请输入正确的重量上限!");
                txt_fMaxWeight.Focus(); return;
            }
            if (!decimal.TryParse(txt_fMinWeight.Text.Trim(), out num))
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowInformation("请输入正确的重量下限!");
                txt_fMinWeight.Focus(); return;
            }
            var _obj = new
            {
                guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建
@@ -301,9 +343,7 @@
                return;
            }
            getModel(rowGuid);
            List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
            gvList.Add(gvMx1);
            UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList);
        }
        private void getModel(string strGuid)
        {
@@ -350,7 +390,6 @@
                    {
                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
                    }
                    UtilityHelper.SetCheckIco(null, "", "", "", picCheckBox, this, (txt_isCheck.Checked == true ? 1 : 0).ToString());
                }
                else
@@ -405,13 +444,76 @@
                MsgHelper.Warning(_rtn.rtnData.outMsg.ToString());
                if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
                {
                    if (xtraTabControl1.SelectedTabPageIndex == 1)
                    getModel(lbGuid.Text.Trim());
                }
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// 移出工序
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            var rowhandle = gvMx1.FocusedRowHandle;
            if (rowhandle < 0)
                return;
            if (e.Button.Index == 0)
            {
                var dr = gvMx1.GetDataRow(rowhandle);
                var mxGuid = dr["guid"].ToString();
                if (!MsgHelper.AskQuestion("你选择了1条数据,确定删除吗?"))
                    return;
                if (string.IsNullOrEmpty(mxGuid))
                {
                    gvMx1.DeleteRow(rowhandle);
                    return;
                }
                var _obj = new
                {
                    guid = lbGuid.Text.Trim(),//这是产品的guid
                    mxGuid = mxGuid,
                };
                try
                {
                    var strJson = UtilityHelper.HttpPost("",
                        _webServiceName + "DeleteModelOrMx",
                        JsonConvert.SerializeObject(_obj));
                    var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                    if (_rtn.rtnCode > 0)
                    {
                        getModel(lbGuid.Text.Trim());
                        if (_rtn.rtnCode > 0) getModel(lbGuid.Text);
                    }
                    int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid);
                    gridView1.FocusedRowHandle = rowHandle;
                    // UtilityHelper.SetCheckIco(gridView1, "status", "checkUser", "checkDate", picCheckBox, this, _inFieldValue.ToString());
                    MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                }
                catch (Exception ex)
                {
                    MsgHelper.Warning("提示:" + ex.Message);
                }
            }
        }
        /// <summary>
        /// 读取工序下拉
        /// </summary>
        private void _getListJyxm()
        {
            var pgq = new PageQueryModel(1, 999999, "a.processNo", "asc", "", "");
            var json = JsonConvert.SerializeObject(pgq);
            try
            {
                var strReturn = UtilityHelper.HttpPost("", "WorkPro/GetListPage", json);
                var dd = UtilityHelper.ReturnToTablePage(strReturn);
                DataTable dt = dd.rtnData.list;
                rptGx.Items.Add("空");
                foreach (DataRow dr in dt.Rows)
                {
                    rptGx.Items.Add(dr["processNo"].ToString());
                }
            }
            catch (Exception ex)