bug
lu
昨天 aa64d5ff0554624339d504f926e955c0ce339b0b
DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs
@@ -16,6 +16,7 @@
        string _webServiceName = "MesCgthSqManager/";
        List<FilterEntity> _filterList = new List<FilterEntity>();
        string _ucGys = "";//供应商
        string _ucBm = "";//部门
        public Frm_MesCgthSq()
        {
            InitializeComponent();
@@ -51,6 +52,8 @@
                if (string.IsNullOrEmpty(orgId))
                    return;
                txt_suppId.getSuppler(orgId, _ucGys);
                txt_fPurchaseDeptId.getSuppler(orgId, _ucBm);
                // txt_fPurchaserId.getSuppler();
            };
            //选择需要的明细
            btnSelect.Click += (s, e) =>
@@ -60,38 +63,61 @@
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("请先选择供应商!");
                    return;
                }
                var frm = new SelectMesCgthSq(this.txt_suppId.GetId(), this.txt_thOrgId.GetId());
                //赋值给明细表
                frm.UpdateParent += (ss, ee) =>
                if (txt_fHasLinkRad.SelectedIndex == 0)
                {
                    try
                    var frm = new SelectMesCgthSq(this.txt_suppId.GetId(), this.txt_thOrgId.GetId());
                    //赋值给明细表
                    frm.UpdateParent += (ss, ee) =>
                    {
                        var lst = new List<string>();
                        lst = ee.StringList;
                        var _obj = lst;
                        var strReturn = UtilityHelper.HttpPost("",
                            _webServiceName + "SelectFormTo",
                            JsonConvert.SerializeObject(_obj));
                        var dt = UtilityHelper.ReturnToList(strReturn);
                        DataTable _newTable = dt.rtnData;
                        DataTable _oldTable = (DataTable)gcMx1.DataSource;
                        DataRow[] sourceRows = _newTable.Select();
                        for (int i = 0; i < sourceRows.Length; i++)
                        try
                        {
                            _oldTable.ImportRow(sourceRows[i]);
                            var lst = new List<string>();
                            lst = ee.StringList;
                            var _obj = lst;
                            var strReturn = UtilityHelper.HttpPost("",
                                _webServiceName + "SelectFormTo",
                                JsonConvert.SerializeObject(_obj));
                            var dt = UtilityHelper.ReturnToList(strReturn);
                            DataTable _newTable = dt.rtnData;
                            DataTable _oldTable = (DataTable)gcMx1.DataSource;
                            DataRow[] sourceRows = _newTable.Select();
                            for (int i = 0; i < sourceRows.Length; i++)
                            {
                                _oldTable.ImportRow(sourceRows[i]);
                            }
                            gcMx1.BindingContext = new BindingContext();
                            gcMx1.DataSource = _oldTable;
                            gcMx1.ForceInitialize();
                            gvMx1.BestFitColumns();
                            Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1);
                        }
                        gcMx1.BindingContext = new BindingContext();
                        gcMx1.DataSource = _oldTable;
                        gcMx1.ForceInitialize();
                        gvMx1.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1);
                    }
                    catch (Exception ex)
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    };
                    frm.ShowDialog();
                    return;
                }
                if (txt_fHasLinkRad.SelectedIndex == 1)
                {
                    var frm2 = new SelectMesCgthSqLink(this.txt_thOrgId.GetId());
                    frm2.UpdateParent += (ss, ee) =>
                    {
                        MessageBox.Show(ex.Message);
                    }
                };
                frm.ShowDialog();
                    };
                    frm2.ShowDialog();
                    return;
                }
            };
            //源单事件
            txt_fHasLinkRad.SelectedIndex = 0;
            layItem1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            layItem2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            layItem3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            layItem4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            txt_fHasLinkRad.SelectedIndexChanged += (s, e) =>
            {
                setSrm();
            };
        }
        private async void GridView1_ColumnFilterChanged(object sender, EventArgs e)
@@ -271,6 +297,15 @@
                gvList.Add(gvMx1);
                UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList);
            }
            //2025/07/12加上修改状态下不能修改
            setSrm();
            txt_thOrgId.IsReadly = true;
            txt_suppId.IsReadly = true;
            txt_fHasLinkRad.ReadOnly = true;
            txt_fRequireOrgId.IsReadly = true;
            txt_fOwnerIdHead.IsReadly = true;
            txt_fPurchaseDeptId.IsReadly = true;
            txt_fPurchaserId.IsReadly = true;
        }
        /// <summary>
        /// 新增事件
@@ -287,7 +322,9 @@
            Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
            //增加时,默认组织
            string deftOrg = UtilityHelper.GetFirstOrg(txt_thOrgId);
            string deftXqOrg = UtilityHelper.GetFirstOrg(txt_fRequireOrgId);
            string deftHzOrg = UtilityHelper.GetFirstOrg(txt_fOwnerIdHead);
            setSrm();
        }
        /// <summary>
        /// 保存事件
@@ -298,30 +335,62 @@
        {
            toolBarMenu1.isSetBtn = false;
            var _gysId = txt_suppId.GetId(); //供应商编号
            string _orgId = txt_thOrgId.GetId();
            string _orgId = txt_thOrgId.GetId();//退货组织
            string _xqzz = txt_fRequireOrgId.GetId();//需求组织
            string _hz = txt_fOwnerIdHead.GetId();//货主
            string _bm = txt_fPurchaseDeptId.GetId();//部门
            string _ygbh = txt_fPurchaserId.GetId();//员工
            if (string.IsNullOrEmpty(_orgId))
            {
                MsgHelper.Warning("请选择组织!");
                MsgHelper.ShowError("请选择组织!");
                txt_thOrgId.Focus();
                return;
            }
            if (string.IsNullOrEmpty(_gysId))
            {
                MsgHelper.Warning("请选择供应商!");
                MsgHelper.ShowError("请选择供应商!");
                txt_suppId.Focus();
                return;
            }
            if (txt_returnMethod.SelectedIndex <= 0)
            {
                MsgHelper.Warning("请选择退料方式!");
                MsgHelper.ShowError("请选择退料方式!");
                txt_returnMethod.Focus();
                return;
            }
            if (txt_returnType.SelectedIndex <= 0)
            {
                MsgHelper.Warning("请选择退料原因!");
                MsgHelper.ShowError("请选择退料原因!");
                txt_returnType.Focus();
                return;
            }
            //无源单要加上条件
            if (txt_fHasLinkRad.SelectedIndex == 1)
            {
                if (string.IsNullOrEmpty(_xqzz))
                {
                    MsgHelper.ShowError("请选择需求组织!");
                    txt_fRequireOrgId.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(_hz))
                {
                    MsgHelper.ShowError("请选择货主!");
                    txt_fOwnerIdHead.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(_bm))
                {
                    MsgHelper.ShowError("请选择部门!");
                    txt_fPurchaseDeptId.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(_ygbh))
                {
                    MsgHelper.ShowError("请选择员工!");
                    txt_fPurchaserId.Focus();
                    return;
                }
            }
            var _obj = new
            {
@@ -331,6 +400,12 @@
                FType = txt_isOut.Checked == true ? 1 : 0,  //0=采购,1=委外
                Fmrmode = txt_returnMethod.Text,//退料方式
                Reason = txt_returnType.Text,//退料原因
                thOrgId = _orgId,
                fHasLink = txt_fHasLinkRad.SelectedIndex,
                fRequireOrgId = _xqzz,
                fPurchaseDeptId = _bm,
                fPurchaserId = _ygbh,
                fOwnerIdHead = _hz,
                list = new List<dynamic>(),
            };
            gvMx1.CloseEditor();
@@ -375,9 +450,9 @@
                    _webServiceName + "EditModel",
                    JsonConvert.SerializeObject(_obj));
                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                if (_rtn.rtnCode > 0)
                {
                    MsgHelper.ShowInformation("提示:" + _rtn.rtnMsg);
                    lbGuid.Text = _rtn.rtnData.outGuid;
                    txt_billNo.Text = _rtn.rtnData.outNo;
                    toolBarMenu1.isSetBtn = true;
@@ -387,10 +462,12 @@
                    toolBarMenu1.currentAction = "";
                    Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6);
                }
                else
                    MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
                MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
@@ -447,7 +524,7 @@
            if (toolBarMenu1.currentAction == "edit") isEdit = true;
            if (string.IsNullOrEmpty(strGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                ToolBox.MsgHelper.ShowError("请先选择你要操作的行!");
                return;
            }
            var _obj = new
@@ -462,11 +539,13 @@
                {
                    dynamic dy = _rtn.rtnData;
                    _ucGys = dy.suppId;
                    _ucBm = dy.fPurchaseDeptId;
                    lbGuid.Text = strGuid;
                    List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                    gvList.Add(gvMx1);
                    UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList);
                    _ucGys = "";
                    _ucBm = "";
                    JObject _job = JObject.Parse(strJson);
                    JArray array = new JArray();
                    foreach (var a in _job["rtnData"]["list"])
@@ -486,13 +565,14 @@
                    {
                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
                    }
                    setSrm();
                }
                else
                    ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                    ToolBox.MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
                ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
        /// <summary>
@@ -510,13 +590,14 @@
                case 0:
                    strMsg = "反审核";
                    break;
            };
            }
            ;
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1, "billNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
                MsgHelper.ShowError("请先选择你要操作的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定" + strMsg + "吗?"))
@@ -532,9 +613,9 @@
                    _webServiceName + "EditModelSubmit",
                    JsonConvert.SerializeObject(_obj));
                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                MsgHelper.Warning(_rtn.rtnData.outMsg.ToString());
                if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
                {
                    MsgHelper.ShowInformation(_rtn.rtnData.outMsg.ToString());
                    if (xtraTabControl1.SelectedTabPageIndex == 1)
                    {
                        getModel(lbGuid.Text.Trim());
@@ -543,10 +624,12 @@
                    gridView1.FocusedRowHandle = rowHandle;
                    UtilityHelper.SetCheckIco(gridView1, "status", "checkUser", "checkDate", picCheckBox, this, _inFieldValue.ToString());
                }
                else
                    MsgHelper.ShowError(_rtn.rtnData.outMsg.ToString());
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
                MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
@@ -587,13 +670,15 @@
                    var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                    if (_rtn.rtnCode > 0)
                    {
                        if (_rtn.rtnCode > 0) getModel(lbGuid.Text);
                        getModel(lbGuid.Text);
                        MsgHelper.ShowInformation("提示:" + _rtn.rtnMsg);
                    }
                    MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                    else
                        MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
                }
                catch (Exception ex)
                {
                    MsgHelper.Warning("提示:" + ex.Message);
                    MsgHelper.ShowError("提示:" + ex.Message);
                }
            }
        }
@@ -608,13 +693,13 @@
            var rowhandle = gvMx1.FocusedRowHandle;
            if (rowhandle < 0)
                return;
            //var dr = gvMx1.GetDataRow(rowhandle);
            var strOrgGuid = txt_thOrgId.GetId();
            if (string.IsNullOrEmpty(strOrgGuid))
            {
                MsgHelper.Warning("提示:请先选择调出组织!");
                MsgHelper.ShowError("提示:请先选择调出组织!");
                return;
            };
            }
            ;
            SelectCk frm = new SelectCk(strOrgGuid);
            frm.UpdateParent += (ss, ee) =>
            {
@@ -625,5 +710,26 @@
            };
            frm.ShowDialog();
        }
        private void setSrm()
        {
            int ddd = txt_fHasLinkRad.SelectedIndex;
            if (ddd == 0)
            {
                layItem1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                layItem2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                layItem3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                layItem4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            }
            else
            {
                layItem1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                layItem2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                layItem3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                layItem4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
            }
        }
    }
}