lu
2024-11-28 fad2478c12172e84ffb47ae2b97654108ee8856c
DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs
@@ -1,3 +1,5 @@
using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Views.Grid;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Gs.DevApp.UserControl;
@@ -46,10 +48,16 @@
                Rectangle r = new Rectangle(gridView1.GridControl.Width / 2 - 100, e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5);
                e.Graphics.DrawString(str, f, Brushes.Gray, r);
            };
            txt_pba013.EditChanged += (s, e) =>
            {
                string workGuid = this.txt_pba013.GetGuid();
                txt_pba016.getSuppler(workGuid);
                _getListJybz(workGuid);
            };
            //选择需要入库的明细
            btnSelect.Click += (s, e) =>
            {
                if (string.IsNullOrEmpty(this.txt_pba013.Text))
                if (string.IsNullOrEmpty(this.txt_pba013.GetId()))
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("请先选择车间,才能选择任务单!");
                    return;
@@ -85,6 +93,8 @@
                };
                frm.ShowDialog();
            };
        }
        /// <summary>
@@ -242,7 +252,7 @@
        {
            string rowGuid = "", rowName = "";
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_hNo, gridView1,"hNo");
                lbGuid, txt_hNo, gridView1, "hNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
@@ -325,19 +335,32 @@
        private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
        {
            toolBarMenu1.isSetBtn = false;
            //if (string.IsNullOrEmpty(txt_account.Text.Trim()))
            //{
            //    Gs.DevApp.ToolBox.MsgHelper.Warning("登录账号不能为空!");
            //    txt_account.Focus();
            //    return;
            //}
            var _sb = new StringBuilder();
            string workId = txt_pba013.GetId();
            if (string.IsNullOrEmpty(workId.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择车间!");
                txt_pba013.Focus();
                return;
            }
            string lineId = txt_pba016.GetId();
            if (string.IsNullOrEmpty(lineId.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择产线!");
                txt_pba016.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txt_pba015.Text.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("计划人数不能为空!");
                txt_pba015.Focus();
                return;
            }
            var _obj = new
            {
                guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建
                bz = txt_pba009.Text.Trim(),
                cjId = 1,
                cxId = 1,
                cjId = workId,
                cxId = lineId,
                jhrs = txt_pba015.Text.Trim(),
                list = new List<dynamic>(),
            };
@@ -522,5 +545,51 @@
                }
            }
        }
        private void _getListJybz(string workGuid)
        {
            if (string.IsNullOrEmpty(workGuid))
                return;
            var _obj = new
            {
                guid = workGuid //主建
            };
            var json = JsonConvert.SerializeObject(_obj);
            try
            {
                var strReturn = UtilityHelper.HttpPost("",
                    "SysDepartmentManager/GetModel", json);
                var _job = JObject.Parse(strReturn);
                var array = new JArray();
                var d = _job["rtnData"]["list"];
                foreach (var a in d) array.Add(a);
                var dt = JsonConvert.DeserializeObject<DataTable>(array.ToString());
                foreach (DataRow dr in dt.Rows)
                {
                    rptJYBZ.Items.Add((new CboItemEntity(dr["id"].ToString(), dr["name"].ToString())));
                }
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        private void rptJYBZ_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBoxEdit comboBox = sender as ComboBoxEdit;
            if (comboBox != null)
            {
                GridView myView = (gcMx1.MainView as GridView);
                int dataIndex = myView.GetDataSourceRowIndex(myView.FocusedRowHandle);
                CboItemEntity _itm = comboBox.EditValue as CboItemEntity;
                string _val = _itm.Value.ToString();
                string _txt = _itm.Text.ToString();
                gvMx1.CloseEditor();
                gvMx1.UpdateCurrentRow();
                gvMx1.SetRowCellValue(dataIndex, "daa015LineName", _txt);
                gvMx1.SetRowCellValue(dataIndex, "daa015", _val);
            }
        }
    }
}