bug
lu
6 天以前 9f39dae41a224582c35e8aeba5d6b2a77ed994fc
DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_MesShouTuo.cs
@@ -14,13 +14,10 @@
{
    public partial class Frm_MesShouTuo : DevExpress.XtraEditors.XtraForm
    {
        string _webServiceName = "MesItemQtrkManager/";
        string _webServiceName = "MesShouTuoManager/";
        List<FilterEntity> _filterList = new List<FilterEntity>();
        string _ucGys = "";//供应商
        string _ucBm = "";//领料部门
        string _ucCk = "";//发料仓库
        string _ucHzlx = "";//货主类型
        string _ucHz = "";//货主
        string _ucCk = "";//仓库
        string _ucKh = "";//客户
        public Frm_MesShouTuo()
        {
            InitializeComponent();
@@ -37,32 +34,27 @@
            this.toolBarMenu1.getXmlConfig();
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "isSh", "", (value) =>
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "isCheck", "", (value) =>
            {
                Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
            });
            }, tips);
            Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
            {
                getModel(value);
            }, (value) =>
            {
                getPageList(this.pageBar1.CurrentPage);
            });
            }, lbGuid);
            getPageList(1);
            pageBar1.PagerEvent += PageBar1_PagerEvent;
            //选择库存组织(变明细中的物料和变货主)
            this.txt_qt022.EditChanged += (s, e) =>
            this.txt_fStockOrgId.EditChanged += (s, e) =>
            {
                string _orgId = txt_qt022.GetId();
                string _orgId = txt_fStockOrgId.GetId();
                if (string.IsNullOrEmpty(_orgId))
                    return;
                ucLookHuoZhu1.OrgId = _orgId;
                ucLookHuoZhu1.HzId = _ucHz;
                ucLookHuoZhu1.SetHzLx(_ucHzlx);
                txt_qt009.getSuppler(_orgId, _ucBm);
                txt_qt018.getSuppler(_orgId, _ucGys);
                txt_qt008.getSuppler(_orgId, _ucCk);
                txt_fCustId.getSuppler(_orgId, _ucKh);
                txt_fStockId.getSuppler(_orgId, _ucCk);
                System.Text.StringBuilder sbWhere = new System.Text.StringBuilder();
                sbWhere.Append(" and a.FSubsidiary ='" + _orgId + "'");
                var _obj = new PageQueryModel(1, 999999, "item_no", "asc", "", sbWhere.ToString(), "");
@@ -81,23 +73,19 @@
                }
            };
            gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged;
            this.ucBtnPrint1.btnDesignClick += (s, e) =>
            {
                ucBtnPrint1.rptParameter = "rpt_Qtrk{}";
            };
            this.ucBtnPrint1.btnReportClick += (s, e) =>
            this.ucBtnPrint1.btnPrintClick += (s, e) =>
            {
                ucBtnPrint1.guidKey = "";
                string rowGuid = lbMxGuid.Text.Trim();
                ucBtnPrint1.guidKey = rowGuid;
                if (string.IsNullOrEmpty(txt_iCount_1.Text.Trim()))
                if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(txt_iCount_1.Text.Trim(), txt_yuliang_1.Text.Trim()))
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择打印条码张数!");
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("请输入正确的条码数量!");
                    txt_iCount_1.Focus();
                    this.ucBtnPrint1.rptParameter = "return false";
                    return;
                }
                if (string.IsNullOrEmpty(txt_psnQty_1.Text.Trim()))
                if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(txt_psnQty_1.Text.Trim()))
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择打印条码数量!");
                    txt_psnQty_1.Focus();
@@ -110,17 +98,27 @@
                    this.ucBtnPrint1.rptParameter = "return false";
                    return;
                }
                this.ucBtnPrint1.rptParameter = "rpt_Qtrk{" + lbMxGuid.Text.Trim()
                this.ucBtnPrint1.rptParameter = "rpt_Strk{" + lbMxGuid.Text.Trim()
                       + "," + ""
                       + "," + ""
                       + "," + Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(txt_yuliang_1.Text.Trim())
                       + "," + txt_iCount_1.Text.Trim()
                       + "," + txt_psnQty_1.Text.Trim()
                       + "}";
            };
            //自动计算打印量
            txt_psnQty_1.TextChanged += (s, e) =>
            {
                Gs.DevApp.ToolBox.UtilityHelper.PrintJiSuan(txt_psnQty_1, txt_iCount_1, txt_kQty.Text.Trim(), radOut, txt_yuliang_1);
            };
            radOut.SelectedIndexChanged += (s, e) =>
            {
                Gs.DevApp.ToolBox.UtilityHelper.PrintAuto(txt_psnQty_1, txt_iCount_1, radOut, txt_yuliang_1);
            };
        }
        private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
        {
            Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
            _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
            Task.Delay(100);
            getPageList(1);
        }
@@ -134,7 +132,7 @@
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_qtck, gridView1);
                lbGuid, txt_billNo, gridView1);
            toolBarMenu1.guidKey = rowGuid;
        }
@@ -157,7 +155,7 @@
            gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
            gridView1.ActiveFilter.Clear();
            gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
            var frm = new ShowFilter(gridView1.Columns, _filterList);
            var frm = new ShowFilter(gridView1.Columns, _filterList, this.GetType().FullName);
            frm.UpdateParent += Frm_UpdateParent;
            frm.ShowDialog();
        }
@@ -190,7 +188,7 @@
        {
            string rowGuid = "", rowName = "";
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_qtck, gridView1, "qtck");
                lbGuid, txt_billNo, gridView1, "billNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
@@ -256,7 +254,7 @@
        {
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_qtck, gridView1);
                lbGuid, txt_billNo, gridView1);
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
@@ -273,7 +271,6 @@
                gvList.Add(gvMx1);
                gvList.Add(gvMx2);
                UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList);
                ucLookHuoZhu1.Enabled = true;
            }
        }
        /// <summary>
@@ -291,7 +288,8 @@
            UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true, gridViews);
            Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
            Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx2, gvMx2);
            ucLookHuoZhu1.Enabled = true;
            //增加时,默认组织
            string deftOrg = UtilityHelper.GetFirstOrg(txt_fStockOrgId);
        }
        /// <summary>
        /// 保存事件
@@ -301,64 +299,39 @@
        private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
        {
            toolBarMenu1.isSetBtn = false;
            string kcZz = txt_qt022.GetId();//库存组织
            string kcBm = txt_qt009.GetId();//库存部门
            string kcGys = txt_qt018.GetId();//库存供应商
            string djLx = txt_qt003.Text.Trim();//单据类型
            string kcfx = txt_qt019.Text.Trim();//库存方向
            string inHzlx = ucLookHuoZhu1.GetHzLx();//货主类型
            string inHz = ucLookHuoZhu1.GetHzId();//货主
            string inRkyy = txt_qt010.Text.Trim();//入库原因
            string kcCk = txt_qt008.GetId();//仓库
            string kcZz = txt_fStockOrgId.GetId();//库存组织
            string inRkyy = txt_remark.Text.Trim();//原因
            string kcCk = txt_fStockId.GetId();//仓库
            string kh = txt_fCustId.GetId();//客户
            if (string.IsNullOrEmpty(kcZz))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择库存组织!");
                txt_qt022.Focus();
                return;
            }
            if (string.IsNullOrEmpty(inHzlx))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择货主类型!");
                return;
            }
            if (string.IsNullOrEmpty(inHz))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择货主!");
                return;
            }
            if (txt_qt003.SelectedIndex < 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择单据类型!");
                txt_qt003.Focus();
                return;
            }
            if (txt_qt019.SelectedIndex <= 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择库存方向!");
                txt_qt019.Focus();
                txt_fStockOrgId.Focus();
                return;
            }
            if (string.IsNullOrEmpty(kcCk))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择收料仓库!");
                txt_qt008.Focus();
                txt_fStockId.Focus();
                return;
            }
            if (string.IsNullOrEmpty(kh))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择客户!");
                txt_fCustId.Focus();
                return;
            }
            var _obj = new
            {
                guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建
                kcZz = kcZz,//库存组织
                kcBm = kcBm,//库存部门
                kcGys = kcGys,//库存供应商
                kcCk = kcCk,//库存仓库
                inRkyy = inRkyy,//入库原因
                djLx = djLx,//单据类型
                kcfx = kcfx,//库存方向
                hzlx = inHzlx,//货主类型
                inHz = inHz,//货主
                kh = kh,
                list = new List<dynamic>(),
            };
            gvMx1.CloseEditor();
            gvMx1.PostEditor();
            gvMx1.UpdateCurrentRow();
            if (gvMx1.DataRowCount <= 0)
            {
@@ -371,7 +344,7 @@
                if (row != null)
                {
                    Guid? _guid = UtilityHelper.ToGuid(row["guid"].ToString());
                    string _msl = row["qd007"].ToString();
                    string _msl = row["Sqsl"].ToString();
                    if (string.IsNullOrEmpty(_msl))
                    {
                        MsgHelper.ShowError("数量不能为空!");
@@ -381,8 +354,8 @@
                    {
                        Guid = _guid,
                        ItemId = (row["itemId"].ToString()),
                        Sqsl = (row["qd007"].ToString()),
                        Bz = (row["qd010"].ToString()),
                        Sqsl = (row["Sqsl"].ToString()),
                        Bz = (row["remark"].ToString()),
                    });
                }
            }
@@ -394,14 +367,14 @@
                if (_rtn.rtnCode > 0)
                {
                    lbGuid.Text = _rtn.rtnData.outGuid;
                    txt_qtck.Text = _rtn.rtnData.outNo;
                    txt_billNo.Text = _rtn.rtnData.outNo;
                    toolBarMenu1.isSetBtn = true;
                    List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                    gvList.Add(gvMx1);
                    gvList.Add(gvMx2);
                    UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false, gvList);
                    ucLookHuoZhu1.Enabled = false;
                    toolBarMenu1.currentAction = "";
                    Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6);
                }
            }
            catch (Exception ex)
@@ -417,8 +390,8 @@
        /// <param name="pageSize">每页几条</param>
        private void getPageList(int curPage)
        {
            var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
            PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "qt001", "asc", "", _sbSqlWhere.ToString());
            gcMain1.DataSource = null;var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
            PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "billNo", "asc", "", _sbSqlWhere.ToString());
            string json = JsonConvert.SerializeObject(pgq);
            try
            {
@@ -433,7 +406,7 @@
                    {
                        gcMain1.DataSource = dt;
                        gcMain1.ForceInitialize();
                        gridView1.BestFitColumns();
                        gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1);
                    }
                    else
                        UtilityHelper.SetDefaultTable(gcMain1, gridView1);
@@ -454,6 +427,7 @@
        }
        private void getModel(string strGuid)
        {
            gcMx1.DataSource = null;
            bool isEdit = false;
            if (toolBarMenu1.currentAction == "add") return;
            if (toolBarMenu1.currentAction == "edit") isEdit = true;
@@ -473,22 +447,14 @@
                if (_rtn.rtnCode > 0)
                {
                    dynamic dy = _rtn.rtnData;
                    _ucGys = dy.qt018;
                    _ucBm = dy.qt009;
                    _ucCk = dy.qt008;
                    _ucHzlx = dy.qt023;
                    _ucHz = dy.qt024;
                    _ucCk = dy.fStockId;
                    _ucKh = dy.fCustId;
                    lbGuid.Text = strGuid;
                    List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                    gvList.Add(gvMx1);
                    gvList.Add(gvMx2);
                    UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList);
                    _ucGys = "";
                    _ucBm = "";
                    _ucCk = "";
                    _ucHzlx = "";
                    _ucHz = "";
                    ucLookHuoZhu1.Enabled = isEdit;
                    JObject _job = JObject.Parse(strJson);
                    JArray array = new JArray();
                    foreach (var a in _job["rtnData"]["list"])
@@ -502,6 +468,7 @@
                        gcMx1.DataSource = dt;
                        gcMx1.ForceInitialize();
                        gvMx1.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1);
                    }
                    else
                    {
@@ -519,6 +486,7 @@
                        gcMx2.DataSource = dt2;
                        gcMx2.ForceInitialize();
                        gvMx2.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx2);
                    }
                    else
                    {
@@ -538,11 +506,13 @@
        {
            SearchLookUpEdit LookupEdit = sender as SearchLookUpEdit;
            DataRowView SelectedDataRow = (DataRowView)LookupEdit.GetSelectedDataRow();
            gvMx1.SetFocusedRowCellValue("qd002", SelectedDataRow["itemNo"]);
            gvMx1.SetFocusedRowCellValue("qd003", SelectedDataRow["itemName"]);
            gvMx1.SetFocusedRowCellValue("qd004", SelectedDataRow["itemModel"]);
            gvMx1.SetFocusedRowCellValue("itemNo", SelectedDataRow["itemNo"]);
            gvMx1.SetFocusedRowCellValue("itemName", SelectedDataRow["itemName"]);
            gvMx1.SetFocusedRowCellValue("itemModel", SelectedDataRow["itemModel"]);
            gvMx1.SetFocusedRowCellValue("kcDw", SelectedDataRow["dwName"]);
            gvMx1.SetFocusedRowCellValue("itemId", SelectedDataRow["id"]);
            gvMx1.PostEditor();
            gvMx1.UpdateCurrentRow();
        }
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
@@ -625,7 +595,7 @@
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
               lbGuid, txt_qtck, gridView1, "qtck");
               lbGuid, txt_billNo, gridView1, "billNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
@@ -653,7 +623,7 @@
                    }
                    int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid);
                    gridView1.FocusedRowHandle = rowHandle;
                    UtilityHelper.SetCheckIco(gridView1, "isSh", "qt016", "qt002", picCheckBox, this, _inFieldValue.ToString());
                    UtilityHelper.SetCheckIco(gridView1, "isCheck", "checkBy", "checkDate", picCheckBox, this, _inFieldValue.ToString());
                }
            }
            catch (Exception ex)
@@ -668,21 +638,36 @@
                DataRow row = gvMx1.GetDataRow(e.FocusedRowHandle);
                lbMxGuid.Text = row["guid"].ToString();
                ucBtnPrint1.guidKey = row["guid"].ToString();
                txtWlid.Text = row["qd002"].ToString();
                txtWlgg.Text = row["qd004"].ToString();
                txtWlmc.Text = row["qd003"].ToString();
                txtQuantity.Text = row["qd007"].ToString();//申请总量
                txtWlid.Text = row["itemNo"].ToString();
                txtWlgg.Text = row["itemModel"].ToString();
                txtWlmc.Text = row["itemName"].ToString();
                txtQuantity.Text = row["sqsl"].ToString();//申请总量
                txtYdy.Text = row["ydy"].ToString();//已打印总量
                txtKdy.Text = row["kdy"].ToString();//可打印总量
                txt_kQty.Text = row["kdy"].ToString();//可打印总量
            }
            else
            {
                lbMxGuid.Text = "";
                ucBtnPrint1.guidKey = "";
                txtWlid.Text = "";
                txtWlgg.Text = "";
                txtWlmc.Text = "";
                txtQuantity.Text = "";
                txtYdy.Text = "";
                txt_kQty.Text = "";
                txt_psnQty_1.Text = "";
                txt_iCount_1.Text = "";
            }
        }
        /// <summary>
        /// 移出条码
        /// 重打条码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void repositoryItemButtonEdit2_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            MsgHelper.ShowInformation("功能开发中!");
            return;
            var rowhandle = gvMx2.FocusedRowHandle;
            if (rowhandle < 0)
                return;
@@ -700,7 +685,7 @@
                try
                {
                    var strJson = UtilityHelper.HttpPost("",
                        _webServiceName + "DeleteBarcode",
                           "VArrivalBarcodeManager/DeleteBarcode",
                        JsonConvert.SerializeObject(_obj));
                    var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                    if (_rtn.rtnCode > 0)