lu
2024-10-25 fe09fca3e77be09fed738a975ff9c5a508c2dd0d
DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_MesInvItemArn.cs
@@ -1,7 +1,9 @@
using DevExpress.XtraGrid.Views.Base.ViewInfo;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using MES.Service.Modes;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
@@ -26,6 +28,8 @@
            this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
            this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
            this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
            this.toolBarMenu1.btnJianYanClick += ToolBarMenu1_btnJianYanClick;
            this.toolBarMenu1.btnFjianYanClick += ToolBarMenu1_btnFjianYanClick;
            gcMain.MouseDoubleClick += GcMain_MouseDoubleClick;
            getPageList(1, UtilityHelper.GetPageSize());
            pageBar1.PagerEvent += PageBar1_PagerEvent;
@@ -53,12 +57,55 @@
                Gs.DevApp.UserControl.SelectCgMx frm = new UserControl.SelectCgMx();
                frm.UpdateParent += (ss, ee) =>
                {
                    List<string> _StringList = new List<string>();
                    _StringList = ee.StringList;
                    MessageBox.Show(_StringList.Count.ToString());
                    List<string> lst = new List<string>();
                    lst = ee.StringList;
                    var _obj = lst;
                    string strReturn = UtilityHelper.HttpPost("", "MesInvItemArnDetailManager/GetListPageByCgmxGuid", JsonConvert.SerializeObject(_obj));
                    ReturnModel<DataTable> dt = UtilityHelper.ReturnToList(strReturn);
                    gcMx1.BindingContext = new BindingContext();
                    gcMx1.DataSource = dt.rtnData;
                    gcMx1.ForceInitialize();
                };
                frm.ShowDialog();
            };
            ucLookCk1.EditChanged += (s, e) =>
            {
                var ddd = this.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)
        {
            this.toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1);
            this.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)
        {
            this.toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1);
            this.toolBarMenu1.guidKey = rowGuid;
        }
        /// <summary>
@@ -121,7 +168,7 @@
        private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e)
        {
            string rowGuid = "", rowName = "";
            // (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1);
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1);
            if (string.IsNullOrEmpty(rowGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
@@ -167,7 +214,7 @@
        private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e)
        {
            string rowGuid = "", rowName = "";
            // (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1);
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1);
            if (string.IsNullOrEmpty(rowGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
@@ -197,17 +244,56 @@
        private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
        {
            toolBarMenu1.isSetBtn = false;
            //if (string.IsNullOrEmpty(txt_account.Text.Trim()))
            string _ckCode = ucLookCk1.GetValue()[2];//仓库编号 depots_code
            string _gysCode = ucLookSupplier1.GetValue()[2];//供应商编号
            if (string.IsNullOrEmpty(_ckCode))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("登录账号不能为空!");
                // txt_account.Focus();
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择仓库!");
                ucLookCk1.Focus();
                return;
            }
            var _obj = new
            if (string.IsNullOrEmpty(_gysCode))
            {
                guid = lbGuid.Text.Trim(),//主建
            };
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择供应商!");
                ucLookSupplier1.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txt_paperBillNo.Text.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择送货单号!");
                txt_paperBillNo.Focus();
                return;
            }
            MesInvItemArn _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>();
            gvMx1.CloseEditor();
            gvMx1.UpdateCurrentRow();
            for (int i = 0; i < gvMx1.DataRowCount; i++)
            {
                DataRow 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());
                    _obj.list.Add(new MesInvItemArnDetail
                    {
                        Guid = _guid,
                        AboutGuid = Guid.Parse(row["aboutGuid"].ToString()),
                        ItemNo = row["itemNo"].ToString(),
                        //ItemId= int.Parse( row["itemId"].ToString()),
                        Quantity = decimal.Parse(row["quantity"].ToString()),
                    });
                }
            }
            try
            {
                string strJson = UtilityHelper.HttpPost("", _webServiceName + "EditModel", JsonConvert.SerializeObject(_obj));