lu
2025-02-26 3d429071ceeda5ce75ca660c13459c13f3d92337
DevApp/Gs.DevApp/DevFrm/Sales/Frm_SalesDeliver.cs
@@ -1,7 +1,4 @@
using DevExpress.RichEdit.Export;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Gs.DevApp.UserControl;
@@ -10,7 +7,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -18,7 +14,7 @@
{
    public partial class Frm_SalesDeliver : DevExpress.XtraEditors.XtraForm
    {
        string _webServiceName = "MesInvItemMovesManager/";
        string _webServiceName = "SalesDeliverManager/";
        List<FilterEntity> _filterList = new List<FilterEntity>();
        public Frm_SalesDeliver()
        {
@@ -48,29 +44,33 @@
            });
            getPageList(1);
            pageBar1.PagerEvent += PageBar1_PagerEvent;
            //设置申请组织
            //this.txt_fapporgid.EditChanged += (s, e) =>
            //{
            //    string _sqGuid = txt_fapporgid.GetId();
            //    if (string.IsNullOrEmpty(_sqGuid))
            //        return;
            //    System.Text.StringBuilder sbWhere = new System.Text.StringBuilder();
            //    sbWhere.Append(" and a.FSubsidiary ='" + _sqGuid + "'");
            //    var _obj = new PageQueryModel(1, 999999, "item_no", "asc", "", sbWhere.ToString(), "");
            //    var json = JsonConvert.SerializeObject(_obj);
            //    try
            //    {
            //        var strReturn = UtilityHelper.HttpPost("",
            //            "MesItemsManager/GetListSelect", json);
            //        var rtn = UtilityHelper.ReturnToTablePage(strReturn);
            //        var dt = rtn.rtnData.list;
            //        this.repositoryItemSearchLookUpEdit1.DataSource = dt;
            //    }
            //    catch (Exception ex)
            //    {
            //        MsgHelper.Warning("提示:" + ex.Message);
            //    }
            //};
            //设置销售单
            this.txt_salesId.EditChanged += (s, e) =>
            {
                string _sqGuid = txt_salesId.GetId();
                if (string.IsNullOrEmpty(_sqGuid))
                    return;
                txt_fSalesManID.Text = txt_salesId.GetSalesUserName();
                txt_fCustomerID.Text = txt_salesId.GetSalesCusName();
                txt_fSaleOrgId.Text = txt_salesId.GetSalesOrgName();
                System.Text.StringBuilder sbWhere = new System.Text.StringBuilder();
                sbWhere.Append(" and a.FSubsidiary ='" + _sqGuid + "'");
                var _obj = new PageQueryModel(1, 999999, "item_no", "asc", "", sbWhere.ToString(), "");
                var json = JsonConvert.SerializeObject(_obj);
                try
                {
                    var strReturn = UtilityHelper.HttpPost("",
                        "SalesManager/SelectFormMx", json);
                    var rtn = UtilityHelper.ReturnToTablePage(strReturn);
                    var dt = rtn.rtnData.list;
                    this.repositoryItemSearchLookUpEdit1.DataSource = dt;
                }
                catch (Exception ex)
                {
                    MsgHelper.Warning("提示:" + ex.Message);
                }
            };
        }
        private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
        {
@@ -131,7 +131,7 @@
        {
            string rowGuid = "", rowName = "";
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_billNo, gridView1, "fBillNo");
                lbGuid, txt_billNo, gridView1, "billNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
@@ -239,56 +239,37 @@
        private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
        {
            toolBarMenu1.isSetBtn = false;
            //string djlx = txt_fBillTypeID.Text.ToString();
            //string ywlx = txt_fBusinessType.Text.ToString();
            //string dbfx = txt_fTransferDirect.Text.ToString();
            //string sqOrg = txt_fapporgid.GetId();
            //string dblx = txt_ftranstype.Text.ToString();
            //string dchzlx = txt_fOwnerTypeIdHead.Text.ToString();
            //string drhzlx = txt_fOwnerTypeInIdHead.Text.ToString();
            //if (txt_fBillTypeID.SelectedIndex <= 0)
            //{
            //    Gs.DevApp.ToolBox.MsgHelper.Warning("请选择单据类型!");
            //    txt_fBillTypeID.Focus();
            //    return;
            //}
            //if (txt_fTransferDirect.SelectedIndex <= 0)
            //{
            //    Gs.DevApp.ToolBox.MsgHelper.Warning("请选择调拨方向!");
            //    txt_fTransferDirect.Focus();
            //    return;
            //}
            //if (string.IsNullOrEmpty(sqOrg))
            //{
            //    Gs.DevApp.ToolBox.MsgHelper.Warning("请选择申请组织!");
            //    txt_fapporgid.Focus();
            //    return;
            //}
            //if (txt_fOwnerTypeIdHead.SelectedIndex <= 0)
            //{
            //    Gs.DevApp.ToolBox.MsgHelper.Warning("请选择调出货主类型!");
            //    txt_fOwnerTypeIdHead.Focus();
            //    return;
            //}
            //if (txt_fOwnerTypeInIdHead.SelectedIndex <= 0)
            //{
            //    Gs.DevApp.ToolBox.MsgHelper.Warning("请选择调入货主类型!");
            //    txt_fOwnerTypeInIdHead.Focus();
            //    return;
            //}
            //var _obj = new
            //{
            //    guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建
            //    djlx = djlx,//单据类型
            //    ywlx = ywlx,//业务类型
            //    dbfx = dbfx,//调拨方向
            //    sqOrg = sqOrg,//审请组织
            //    dblx = dblx,//调拨类型
            //    dchzlx = dchzlx,//调出货主类型
            //    drhzlx = drhzlx,//调入货主类型
            //    inRemark = txt_fRemarks.Text.Trim(),//备注
            //    list = new List<dynamic>(),
            //};
            string djlx = txt_fBillTypeID.Text.ToString();
            string FNote = txt_fNote.Text.ToString();
            string _sqGuid = txt_salesId.GetId();
            string _fhOrg = txt_fStockOrgId.GetId();
            if (string.IsNullOrEmpty(_fhOrg))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择发货组织!");
                txt_fStockOrgId.Focus();
                return;
            }
            if (txt_fBillTypeID.SelectedIndex < 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择单据类型!");
                txt_fBillTypeID.Focus();
                return;
            }
            if (string.IsNullOrEmpty(_sqGuid))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择申请组织!");
                txt_salesId.Focus();
                return;
            }
            var _obj = new
            {
                guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建
                djlx = djlx,//单据类型
                salesId = _sqGuid,//销售单号
                inRemark = FNote.Trim(),//备注
                fhOrg = _fhOrg,
                list = new List<dynamic>(),
            };
            gvMx1.CloseEditor();
            gvMx1.UpdateCurrentRow();
            if (gvMx1.DataRowCount <= 0)
@@ -302,42 +283,36 @@
                if (row != null)
                {
                    Guid? _guid = UtilityHelper.ToGuid(row["id"].ToString());
                    string _msl = row["shNum"].ToString();
                    string _msl = row["fMustQty"].ToString();
                    if (string.IsNullOrEmpty(_msl))
                    {
                        MsgHelper.ShowError("数量不能为空!");
                        return;
                    }
                    //_obj.list.Add(new
                    //{
                    //    Guid = _guid,
                    //    ItemId = (row["itemId"].ToString()),
                    //    Sqsl = (row["shNum"].ToString()),
                    //    Bz = (row["remark"].ToString()),
                    //    dczz = (row["dcOrgGuid"].ToString()),
                    //    dcck = (row["dcCkGuid"].ToString()),
                    //    drzz = (row["drOrgGuid"].ToString()),
                    //    drck = (row["drCkGuid"].ToString()),
                    //    dchz = (row["dcHzGuid"].ToString()),
                    //    drhz = (row["drHzGuid"].ToString()),
                    //});
                    _obj.list.Add(new
                    {
                        Guid = _guid,
                        SalesDetailId = (row["salesDetailId"].ToString()),
                        Sqsl = (row["fMustQty"].ToString()),
                        Bz = (row["fEntrynote"].ToString()),
                    });
                }
            }
            try
            {
                //string strJson = UtilityHelper.HttpPost("", _webServiceName + "EditModel", JsonConvert.SerializeObject(_obj));
                //ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                //ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                //if (_rtn.rtnCode > 0)
                //{
                //    lbGuid.Text = _rtn.rtnData.outGuid;
                //    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);
                //    UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false, gvList);
                //    toolBarMenu1.currentAction = "";
                //}
                string strJson = UtilityHelper.HttpPost("", _webServiceName + "EditModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                if (_rtn.rtnCode > 0)
                {
                    lbGuid.Text = _rtn.rtnData.outGuid;
                    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);
                    UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false, gvList);
                    toolBarMenu1.currentAction = "";
                }
            }
            catch (Exception ex)
            {
@@ -493,7 +468,7 @@
            };
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1, "fBillNo");
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1, "billNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
@@ -521,7 +496,7 @@
                    }
                    int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid);
                    gridView1.FocusedRowHandle = rowHandle;
                    UtilityHelper.SetCheckIco(gridView1, "chkStatus", "FAPPROVEBY", "FAPPROVEDATE", picCheckBox, this, _inFieldValue.ToString());
                    UtilityHelper.SetCheckIco(gridView1, "chkStatus", "fApproverID", "fApproveDate", picCheckBox, this, _inFieldValue.ToString());
                }
            }
            catch (Exception ex)
@@ -534,11 +509,12 @@
        {
            SearchLookUpEdit LookupEdit = sender as SearchLookUpEdit;
            DataRowView SelectedDataRow = (DataRowView)LookupEdit.GetSelectedDataRow();
            gvMx1.SetFocusedRowCellValue("itemNo", SelectedDataRow["itemNo"].ToString());
            gvMx1.SetFocusedRowCellValue("itemName", SelectedDataRow["itemName"].ToString());
            gvMx1.SetFocusedRowCellValue("itemModel", SelectedDataRow["itemModel"].ToString());
            gvMx1.SetFocusedRowCellValue("itemId", SelectedDataRow["id"].ToString());
            gvMx1.SetFocusedRowCellValue("itemUnit", SelectedDataRow["dwName"].ToString());
            //gvMx1.SetFocusedRowCellValue("itemNo", SelectedDataRow["itemNo"].ToString());
            //gvMx1.SetFocusedRowCellValue("itemName", SelectedDataRow["itemName"].ToString());
            //gvMx1.SetFocusedRowCellValue("itemModel", SelectedDataRow["itemModel"].ToString());
            //gvMx1.SetFocusedRowCellValue("itemId", SelectedDataRow["id"].ToString());
            //gvMx1.SetFocusedRowCellValue("itemUnit", SelectedDataRow["dwName"].ToString());
            gvMx1.SetFocusedRowCellValue("salesDetailId", SelectedDataRow["id"].ToString());
            gvMx1.CloseEditor();
            gvMx1.UpdateCurrentRow();
        }
@@ -582,6 +558,7 @@
                }
            }
        }
    }
}