iqc
lu
2024-11-06 f924cbebf1695c6323c1ed38f418dccd288fe1b9
DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_MesInvItemArn.cs
@@ -20,10 +20,13 @@
    {
        private List<FilterEntity> _filterList = new List<FilterEntity>();
        private readonly string _webServiceName = "MesInvItemArnManager/";
        public Frm_MesInvItemArn()
        {
            InitializeComponent();
            pageBar1.PagerEvent += PageBar1_PagerEvent;
            this.gridView1.ColumnPanelRowHeight = 60;
            this.gridView1.OptionsView.AllowHtmlDrawHeaders = true;
            this.gridView1.Appearance.HeaderPanel.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
            toolBarMenu1.btnAddClick += ToolBarMenu1_btnAddClick;
            toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick;
            toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick;
@@ -33,9 +36,9 @@
            toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
            toolBarMenu1.btnJianYanClick += ToolBarMenu1_btnJianYanClick;
            toolBarMenu1.btnFjianYanClick += ToolBarMenu1_btnFjianYanClick;
            toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
            gcMain.MouseDoubleClick += GcMain_MouseDoubleClick;
            getPageList(1, UtilityHelper.GetPageSize());
            pageBar1.PagerEvent += PageBar1_PagerEvent;
            gridView1.CustomDrawRowIndicator += (s, e) =>
            {
                if (e.Info.IsRowIndicator && e.RowHandle >= 0)
@@ -49,14 +52,28 @@
                    e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5);
                e.Graphics.DrawString(str, f, Brushes.Gray, r);
            };
            ucLookSupplier1.EditChanged += (s, e) =>
            //设置仓库选择
            this.txt_depotsId.KeyFile = "depotId";
            this.txt_depotsId.EditChanged += (s, e) =>
            {
                var ddd = ucLookSupplier1.GetValue();
                //  lbSupplierName.Text = ddd[1];
                txtDepotsId.Text = this.txt_depotsId.GetId();
            };
            //设置供应商选择
            this.txt_suppId.KeyFile = "id";
            this.txt_suppId.EditChanged += (s, e) =>
            {
                txtSupplierId.Text = this.txt_suppId.GetId();
            };
            //选择需要入库的明细
            btnSelect.Click += (s, e) =>
            {
                var frm = new SelectCgMx();
                if (string.IsNullOrEmpty(this.txt_suppId.GetId()))
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("请先选择供应商,才能选择来料明细!");
                    return;
                }
                var frm = new SelectCgMx(this.txt_suppId.GetId());
                //赋值给明细表
                frm.UpdateParent += (ss, ee) =>
                {
                    var lst = new List<string>();
@@ -66,53 +83,21 @@
                        "MesInvItemArnDetailManager/GetListPageByCgmxGuid",
                        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 = dt.rtnData;
                    gcMx1.DataSource = _oldTable;
                    gcMx1.ForceInitialize();
                };
                frm.ShowDialog();
            };
            ucLookCk1.EditChanged += (s, e) =>
            {
                var ddd = ucLookCk1.GetValue();
                //lbCkName.Text = ddd[1];
            };
        }
        private void ToolBarMenu1_btnFjianYanClick1(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }
        /// <summary>
        ///     反检验
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <exception cref="NotImplementedException"></exception>
        private void ToolBarMenu1_btnFjianYanClick(object sender, EventArgs e)
        {
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_billNo, gridView1);
            toolBarMenu1.guidKey = rowGuid;
        }
        /// <summary>
        ///     检验
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <exception cref="NotImplementedException"></exception>
        private void ToolBarMenu1_btnJianYanClick(object sender, EventArgs e)
        {
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_billNo, gridView1);
            toolBarMenu1.guidKey = rowGuid;
        }
        /// <summary>
        ///     双击事件
@@ -159,7 +144,49 @@
            _filterList = e.FilterList;
            getPageList(1, pageBar1.RowsCount);
        }
        /// <summary>
        /// 日志
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnLogClick(object sender, EventArgs e)
        {
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_billNo, gridView1);
            toolBarMenu1.guidKey = rowGuid;
        }
        /// <summary>
        ///     反检验
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <exception cref="NotImplementedException"></exception>
        private void ToolBarMenu1_btnFjianYanClick(object sender, EventArgs e)
        {
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_billNo, gridView1);
            toolBarMenu1.guidKey = rowGuid;
        }
        /// <summary>
        ///     检验
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <exception cref="NotImplementedException"></exception>
        private void ToolBarMenu1_btnJianYanClick(object sender, EventArgs e)
        {
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_billNo, gridView1);
            toolBarMenu1.guidKey = rowGuid;
        }
        /// <summary>
        ///     取消事件
        /// </summary>
@@ -264,49 +291,51 @@
        private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
        {
            toolBarMenu1.isSetBtn = false;
            var _ckCode = ucLookCk1.GetValue()[2]; //仓库编号 depots_code
            var _gysCode = ucLookSupplier1.GetValue()[2]; //供应商编号
            if (string.IsNullOrEmpty(_ckCode))
            {
                MsgHelper.Warning("请选择仓库!");
                ucLookCk1.Focus();
                return;
            }
            if (string.IsNullOrEmpty(_gysCode))
            var _ckId = txt_depotsId.GetId(); //仓库编号 depots_code
            var _gysId = txt_suppId.GetId(); //供应商编号
            if (string.IsNullOrEmpty(_gysId))
            {
                MsgHelper.Warning("请选择供应商!");
                ucLookSupplier1.Focus();
                txt_suppId.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txt_paperBillNo.Text.Trim()))
            if (string.IsNullOrEmpty(_ckId))
            {
                MsgHelper.Warning("请选择送货单号!");
                txt_paperBillNo.Focus();
                MsgHelper.Warning("请选择仓库!");
                txt_depotsId.Focus();
                return;
            }
            var _obj = new MesInvItemArn();
            _obj.Guid = null; //到货单主键
            _obj.PaperBillNo = txt_paperBillNo.Text.Trim(); //送货单号;
            _obj.Remark = ""; //备注
            _obj.SuppNo = _gysCode; //供应商编号
            _obj.DepotsCode = _ckCode; //仓库编号 depots_code
            _obj.FType = 1; //0=采购,1=委外
            _obj.list = new List<MesInvItemArnDetail>();
            var _obj = new MesInvItemArn()
            {
                Guid = Gs.DevApp.ToolBox.UtilityHelper.ToGuid(lbGuid.Text.Trim()), //到货单主键
                PaperBillNo = txt_paperBillNo.Text.Trim(), //送货单号;
                Remark = txt_remark.Text.Trim(), //备注
                SuppId = _gysId, //供应商
                DepotsId = _ckId,//仓库
                FType = txt_fType.Checked,//0=采购,1=委外
                UrgentFlag = txt_urgentFlag.Checked,//0=不急,1=急
                list = new List<MesInvItemArnDetail>(),
            };
            gvMx1.CloseEditor();
            gvMx1.UpdateCurrentRow();
            if (gvMx1.DataRowCount <= 0)
            {
                MsgHelper.ShowError("明细不能为空,请选择你的收料明细!");
                return;
            }
            for (var i = 0; i < gvMx1.DataRowCount; i++)
            {
                var row = gvMx1.GetDataRow(i);
                if (row != null)
                {
                    Guid? _guid = null;
                    if (string.IsNullOrEmpty(row["guid"].ToString()))
                        _guid = null;
                    else
                        _guid = Guid.Parse(row["guid"].ToString());
                    Guid? _guid = UtilityHelper.ToGuid(row["guid"].ToString());
                    string _msl = row["quantity"].ToString();
                    if (string.IsNullOrEmpty(_msl))
                    {
                        MsgHelper.ShowError("数量不能为空!");
                        return;
                    }
                    _obj.list.Add(new MesInvItemArnDetail
                    {
                        Guid = _guid,
@@ -428,6 +457,11 @@
            }
        }
        /// <summary>
        /// 明细删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void repositoryItemButtonEdit1_ButtonClick(object sender,
            ButtonPressedEventArgs e)
        {
@@ -440,6 +474,11 @@
                var mxGuid = dr["guid"].ToString();
                if (!MsgHelper.AskQuestion("你选择了1条数据,确定删除吗?"))
                    return;
                if (string.IsNullOrEmpty(mxGuid))
                {
                    gvMx1.DeleteRow(rowhandle);
                    return;
                }
                var strJson = "";
                var lst = new List<string>();
                lst.Add(mxGuid);